Next.js · Middle · Question 1 of 75

What is a Server Function (Server Action) in Next.js?

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.

Further reading

Problem with a question

Next.js · Middle · question 1

Test yourself

Take the Next.js · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz