# Next.js 16 Server Actions in 2026: Mutations, Revalidation and Interview Questions > How Next.js 16 Server Actions handle mutations, revalidation, pending state, optimistic UI, and security, with the interview questions that test each concept. - Published: 2026-06-24 - Updated: 2026-07-06 - Author: SharpSkill - Tags: next.js, server-actions, react, mutations, revalidation, interview - Reading time: 11 min --- Next.js Server Actions turn a plain async function into a server-side mutation endpoint that a form can call directly, with no API route, no client `fetch`, and no manual JSON serialization. In Next.js 16 they are the default way to write data mutations, and they appear in nearly every senior React interview in 2026. This deep-dive breaks down how they execute, how revalidation propagates fresh data to the UI, how to model pending and error states, and the security rules that trip up most developers. > **One-Sentence Definition** > > A Server Action is an async function marked with `"use server"` that runs only on the server and can be called from a client component or a form as if it were local, while Next.js handles the network request, argument serialization, and CSRF protection automatically. ## How Server Actions Execute Under the Hood A Server Action is a server-only function invoked over the network through a compiler-generated endpoint. When a function carries the `"use server"` directive, the Next.js compiler never ships its body to the browser. Instead it replaces the function with a lightweight reference: a hashed action ID mapped to a generated POST route. Calling the action from the client sends a request to that route, the real function runs on the server, and the serialized result streams back to the caller. This design has three consequences worth remembering for both production code and interviews. First, arguments and return values must be serializable, because they cross the network as encoded payloads. Second, secrets stay on the server, since the function body is never bundled for the client. Third, actions attached to a `
` work even before hydration, which is why progressive enhancement is a core selling point. The official [Next.js guide on updating data](https://nextjs.org/docs/app/getting-started/updating-data) documents the full execution model. Every Server Action lives in a file or block marked with `"use server"`. A single mutation looks like this: ```typescript // app/posts/actions.ts "use server" import { revalidatePath } from "next/cache" import { redirect } from "next/navigation" import { PostService } from "@/lib/services/post-service" export async function createPost(formData: FormData) { // FormData values arrive as strings; cast explicitly const title = formData.get("title") as string const body = formData.get("body") as string // Run business logic through the service layer, never the ORM directly const post = await PostService.create({ title, body }) // Purge the cached list so the next request refetches it revalidatePath("/posts") // Send the user to the freshly created resource redirect(`/posts/${post.id}`) } ``` The function reads the submitted `FormData`, persists through a service, invalidates the cached listing, and redirects. No client JavaScript is required for any of it. ## Wiring a Server Action to a Form Without Client JavaScript Passing the action to a form's `action` prop is the simplest integration. Next.js serializes the submission into `FormData` and calls the function on the server. Because this uses the native form submission mechanism, it functions with JavaScript disabled and upgrades seamlessly once the page hydrates. ```tsx // app/posts/new-post-form.tsx import { createPost } from "./actions" export default function NewPostForm() { return (