Next.js · Server Actions · Junior · Live Coding
How do you bind a Server Action to a form?
Short Interview Answer
Pass the action to `<form action={serverAction}>` or use `useActionState`/`useFormStatus` patterns.
Detailed Explanation
Works without client JS for basic progressive enhancement. Prefer validated FormData parsing. Revalidate caches after mutation.
Example
async function create(formData: FormData) {
'use server';
// mutate + revalidatePath('/items')
}