'use server'

The directive that marks async functions as Server Actions, callable from the client but always run on the server.

In more detail

Put it at the top of a file to make every export a Server Action, or as the first line inside one async function. It does not make a component a Server Component; that is the default already.

Example

'use server';
export async function registerUser(formData: FormData) { /* ... */ }

Related terms

Taught in

References