Forms in the Server Action Era
Next.js 15 has finalized the Server Actions API. It allows you to define asynchronous functions that run on the server but are called directly from your client components.
### The useActionState Hook
This is the core of modern form management. It manages the state returned by your action, including success messages, error arrays, and the pending status.
### Security and CSRF
Server Actions have built-in CSRF protection. However, you must still validate the 'inputs' because anyone can call your action endpoint with malformed data. Use Zod and our JSON Schema Generator to ensure your data types are perfectly enforced on the server.