useActionState vs useFormState vs useFormStatus

IntermediateReact interview questionBy , updated 3 December 2026

Short answer

useActionState and useFormState are the same hook under two names. useFormState was the Canary name in react-dom. React 19 renamed it to useActionState, moved it to react, added a third isPending value and deprecated the old name. useFormStatus is a different hook: called inside a component rendered within a <form>, it reads that form's pending state and submitted data, which suits a reusable submit button.

The three hooks at a glance

useActionState useFormState useFormStatus
Import from react react-dom react-dom
Status Current Deprecated alias Current
Returns [state, dispatchAction, isPending] The same { pending, data, method, action }
Tracks One Action and the state it returns The same The parent <form>'s submission
Where you call it The component that owns the Action The same A child rendered inside the <form>
Needs a <form> No No Yes

So the real comparison is between two hooks. useActionState answers "what did my Action return, and is it still running?". useFormStatus answers "is the form I am inside submitting right now?".

useActionState: state returned by an Action

You give it an Action and an initial state. React calls the Action with the previous state first and the payload second, and stores whatever it returns.

import { useActionState } from "react";

async function signUp(prevState, formData) {
  const email = formData.get("email");
  const res = await fetch("/api/sign-up", { method: "POST", body: formData });
  if (!res.ok) return { error: "That email is already registered.", email };
  return { error: null, email };
}

export function SignUpForm() {
  const [state, formAction, isPending] = useActionState(signUp, { error: null, email: "" });

  return (
    <form action={formAction}>
      <input name="email" type="email" defaultValue={state.email} required />
      <button disabled={isPending}>{isPending ? "Signing up" : "Sign up"}</button>
      {state.error && <p role="alert">{state.error}</p>}
    </form>
  );
}

Points from the docs that interviewers like to probe:

  • The extra first argument. With useActionState, form data moves to the second argument. A plain form Action is action(formData); the wrapped one is action(prevState, formData).
  • Calls are queued. If the user submits three times quickly, React runs the Action three times in order, each receiving the previous result. That is correct for a counter and slow for a search box.
  • Outside a form, call the returned function inside startTransition, or React logs an error in development and the call is not part of a Transition.
  • With Server Functions the initial state must be serializable, and the optional third argument, permalink, lets the form work before JavaScript loads.

Why it was renamed

The pull request that added useActionState lists the problems with the old name. useFormState did not return the state of any form. It tracked the Action you passed in, and the returned Action could be passed to several forms, so a "form" pending flag would have been misleading. The name also tied it to <form>, though it works with any Action. Renaming it and moving it to react made it usable from any renderer and made room for the isPending value.

Migrating from useFormState

- import { useFormState } from "react-dom";
+ import { useActionState } from "react";

- const [state, formAction] = useFormState(action, initialState);
+ const [state, formAction, isPending] = useActionState(action, initialState);

The arguments are the same. The React 19 migration recipe includes a replace-use-form-state codemod. As of React DOM 19.3, useFormState is still exported and runs the same code, but logs "ReactDOM.useFormState has been renamed to React.useActionState" in development, so treat it as something to remove, not something to keep.

useFormStatus: the form, from the inside

useFormStatus reads the status of the parent <form> as if the form were a context provider. It takes no arguments.

import { useFormStatus } from "react-dom";

function SubmitButton({ children }) {
  const { pending } = useFormStatus();
  return <button type="submit" disabled={pending}>{children}</button>;
}

export function CommentForm({ addComment }) {
  return (
    <form action={addComment}>
      <textarea name="text" required />
      <SubmitButton>Post</SubmitButton>
    </form>
  );
}

The pitfall the docs call out: it only reports on a <form> that is a parent of the calling component. Call it in the same component that renders the <form> and pending is never true. Besides pending, it returns data (the FormData being submitted), method and action, so a button can also show what is being sent.

Using them together

They are not alternatives. A common split is useActionState in the form component for the returned state, such as field errors, and useFormStatus inside shared button and input components so they disable themselves while any form they sit in is submitting, without props. If you already have isPending from useActionState in the same component, pass it down; useFormStatus is for components that cannot see it.

Practise the pieces in Build a sign-up form with useActionState and Fix a submit button that never shows pending, then build the queue yourself in Build useActionState and form actions from scratch. The React 19 Actions guide covers transitions, useOptimistic and form resets.

Common follow-up questions

Is useActionState only for Server Actions?

No. The Action can be any sync or async function. In Next.js it is often a Server Action, as shown in What are Server Actions in Next.js?, but a client function that calls fetch works the same way.

How is useActionState different from useTransition?

useTransition gives you isPending for any work you wrap. useActionState adds the returned state and the queue that passes each result into the next call. If you only need a pending flag, useTransition is enough.

Why are my inputs empty after a failed submit?

When a function passed to a form's action completes without throwing, React resets the form's uncontrolled fields to their default values. An Action that returns an error object has not thrown, so the reset still happens, and inputs with no defaultValue become empty. Return the submitted values from the Action and feed them back as defaultValue, as the sign-up example does.

Can I cancel queued Actions?

If an Action throws, React cancels the queued ones and shows the nearest error boundary. For "latest input wins" behaviour, such as a search, do not use useActionState; use a transition and ignore stale responses.

Mistakes to avoid

  • Importing useFormState from react-dom in new code

  • Writing the Action as action(formData) when useActionState passes prevState first

  • Calling useFormStatus in the component that renders the <form>

  • Calling the returned Action from an event handler without startTransition

  • Using useActionState for requests where only the latest should count, and getting a slow queue

Practise it in code

Interviewers rarely stop at the definition. These questions open in an editor with tests.

  1. Build a sign-up form with useActionState: field errors, kept values, pending and successMedium35 min
  2. Fix a submit button that never shows pending: useFormStatus and the form it readsMedium20 min
  3. Build useActionState and form actions from scratch: a sequential queue, pending state, errors and form resetHard55 min
  4. Build the same contact form three ways: uncontrolled with FormData, controlled, and useActionStateMedium40 min
  5. Build a LoadingButton that keeps its width, blocks double submits and stays accessibleMedium35 min