React · Frontend system thinking

What are Actions in React 19 and how do they handle form updates?

HardReact 19ActionsformsuseActionStateUpdated Oct 2026
Quiz this track

Short answer

Actions are functions that perform a data mutation and integrate with React's pending, error and optimistic UI. Form actions, useActionState, useFormStatus and useOptimistic make async submissions easier to model.

React 19 extends the transition model to mutations. An action can be an async function passed to a form's action prop or called inside startTransition. React tracks the pending state, keeps the form interactive, and lets you show optimistic or error UI without wiring every flag by hand.

jsx
function UpdateName() {
  const [state, formAction, isPending] = useActionState(
    async (previousState, formData) => {
      const result = await saveName(formData.get("name"));

      if (!result.ok) {
        return { ...previousState, error: result.message };
      }

      return { name: String(formData.get("name")), error: null };
    },
    { name: "", error: null },
  );

  return (
    <form action={formAction}>
      <input name="name" defaultValue={state.name} />
      <button disabled={isPending}>Save</button>
      {state.error && <p role="alert">{state.error}</p>}
    </form>
  );
}
React owns the pending state and the form action receives the submitted FormData.

The React 19 pieces

  • <form action={fn}> submits through an action instead of a manual onSubmit handler
  • useActionState returns the latest result, a wrapped action and pending state
  • useFormStatus reads the pending state of the nearest parent form
  • useOptimistic shows a temporary optimistic result while the server responds

For an uncontrolled form, React resets the form after a successful action submission. Errors can be returned as state and rendered next to the field. If the action is a server action, the function runs on the server and its arguments must be serializable.

Actions are not a replacement for every data-fetching cache. They model mutations and submission state. Reading and caching server data still belongs to a router, a data library or a framework's server-component layer.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1How is an action different from an onSubmit handler?
  2. 2What does useActionState return?
  3. 3When would you use useOptimistic?
  4. 4What is the difference between a client action and a server action?

Say it in the interview

Actions are React's model for mutations that need pending and error handling. I can pass an async function to a form action, use useActionState to keep the result and pending flag, and use useOptimistic for immediate feedback. React can reset an uncontrolled form after a successful submission. I still use a data layer for reading and caching server data; actions are for writes, not a universal fetch replacement.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live React mock interview and get scored feedback on depth, clarity and confidence.