form action
The action prop of a form, or formAction on a button, which in React can be a Server Action that receives the submitted FormData.
In more detail
In plain HTML, action is the URL a form posts to. React also accepts a function there, which receives the form data when the form is submitted.
Examples
<form action={registerUser}>...</form>Passing a Next.js Server Action to action works even before JavaScript loads, because React renders a real HTML form that posts to the server.Related terms
- Server Functions — Async functions marked with "use server" that run on the server but can be called from client components, for example as a form action.
- FormData — The standard browser object holding the fields of a submitted form as name and value pairs.
- progressive enhancement — Building a page that works everywhere first, then adding better features for browsers that support them.
Taught in
- Server Actions: use server Directives & Mutations — Next.js 15 & Modern App Router Architecture
- Action State: useActionState & Optimistic Form UI — Next.js 15 & Modern App Router Architecture