data mutation
Any operation that changes stored data, such as creating a user, liking a post or updating stock.
In more detail
Reads can be cached and repeated safely; mutations cannot, so they usually go through POST requests and need access checks. After a mutation, any cached copies of the changed data must be refreshed.
Example
In the App Router mutations usually run in Server Actions followed by revalidatePath or revalidateTag.Related terms
- 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.
- revalidation — Refreshing cached data or pages so they show new content, either after a time limit or on demand.
- optimistic UI — Updating the screen immediately as if an action succeeded, before the server confirms it, and undoing the change if it fails.
Taught in
- 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
- Route Handlers: RESTful Endpoints with NextRequest — Next.js 15 & Modern App Router Architecture