Next.js · Middle · Question 1 of 75
What is a Server Function (Server Action) in Next.js?
- ✓Correct answer: An async function marked
'use server'that can be called from the client - 2A Route Handler that is automatically created for every page
- 3A function that runs at build time and caches its result
Explanation
The 'use server' directive turns a function into a server function, and Next.js creates an endpoint for it. You can pass it to <form action> or call it from a client handler. The call is a POST request. Server Actions are Server Functions used for mutations, often followed by cache revalidation.