Data Fetching: Server Actions and Mutations | Next.js
Server Actions are asynchronous functions that are executed on the server. They can be used in Server and Client Components to handle form submissions and data mutations in Next.js applications. 🎥 Watch: Learn more about forms and mutations with Server Actions → YouTube (10 minutes) . A Server Action can be defined with the React "use server" directive. You can place the directive at the top of an async function to mark the function as a Server Action, or at the top of a separate file to mark all exports of that file as Server Actions. Server Components can use the inline function level or module level "use server" directive. To inline a Server Action, add "use server" to the top of the function body: Client Components can only import actions that use the module-level "use server" directive. To call a Server Action in a Client Component, create a new file and add the "use server" directive at the top of it. All functions within the file will be marked as Server Actions that can be re
This page is also available as Markdown at /docs/app/getting-started/mutating-data.md . For an index of Next.js documentation , see /docs/llms.txt . Copy page Mutating Data Last updated June 23, 2026 You can mutate data in Next.js using React Server Functions . This page will go through how you can create and invoke Server Functions. For Next.js-specific behaviors (single-roundtrip response, sequential dispatch, security, deployment), see Server Actions and Mutations . What are Server Functions? A Server Function is an asynchronous function that runs on the server. You can call them from the c
Explore this link on the map →related reading
- Guides: Forms | Next.jsnextjs.org
- App Router: Mutating Data | Next.jsnextjs.org
- Cursor Docs — Agent, Rules, MCP, Skills & CLIdocs.cursor.com
- Getting Started: Fetching Data | Next.jsnextjs.org
- Getting Started: Fetching Data | Next.jsnextjs.org
- Getting Started: Server and Client Components | Next.jsnextjs.org
- Getting Started: Fetching Data | Next.jsnextjs.org
- React Foundations: Server and Client Components | Next.jsnextjs.org
- Chatbots’ Time Has Come. Why Now?every.to
- Getting Started: Fetching Data | Next.jsnextjs.org
- What Comes After SaaS?every.to
- Usage with Next.js – SWRswr.vercel.app