Server Functions
Async functions marked with "use server" that run on the server but can be called from client components, for example as a form action.
In more detail
Frameworks that support React Server Components, such as Next.js, send the call to the server for you. Server Actions is the earlier name for those used as actions. With server rendering, forms bound to them can submit even before JavaScript has loaded.
Related terms
- 'use server' — The directive that marks async functions as Server Actions, callable from the client but always run on the server.
- data mutation — Any operation that changes stored data, such as creating a user, liking a post or updating stock.
- form action — The action prop of a form, or formAction on a button, which in React can be a Server Action that receives the submitted FormData.
- Server Action security — Treating every Server Action as a public HTTP endpoint that anyone can call with any arguments.
- Action (React) — In React 19, an async function run inside a transition, typically to submit data, with pending state, errors and optimistic updates handled by React.
- useActionState — The React hook that wraps an Action and returns its latest result, a function to trigger it, and an isPending flag.
- progressive enhancement — Building a page that works everywhere first, then adding better features for browsers that support them.
- Next.js — A React framework for building web applications that can render pages on the server and supports React Server Components.
- Route Handlers — Files in a Next.js app, named route.ts, that answer HTTP requests for a path with functions named after methods such as GET and POST.
- untrusted input — Any data a program did not create itself, including arguments, form fields, request bodies, file contents, file names and environment variables.
Taught in
- Serialization Boundaries: Props & Server Guardrails — Next.js 15 & Modern App Router Architecture
- Server Actions: use server Directives & Mutations — Next.js 15 & Modern App Router Architecture
- Action State: useActionState & Optimistic Form UI — Next.js 15 & Modern App Router Architecture
- Optimistic UI: useOptimistic Rollbacks & Transitions — Next.js 15 & Modern App Router Architecture
- Server Action Security: Zod Validation & Auth Gates — Next.js 15 & Modern App Router Architecture
- Router Cache: In-Memory Client Prefetch Semantics — Next.js 15 & Modern App Router Architecture
- useActionState: Async Action Handlers And Pending States — React 19 & Modern Component Architecture
- useOptimistic: Instantaneous UI Updates with Rollback — React 19 & Modern Component Architecture
- The Spine Artifact: Generating Typed Models From OpenAPI — Production TypeScript