Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Use useActionState when you need to keep and display the value returned by a form action. Use useFormStatus when a component inside a form needs to know whether that form is submitting or inspect its current submission. They can work together, but they answer different questions.
What each hook does
| Hook | Use it when | Where to call it | What it provides |
|---|---|---|---|
useActionState |
The action’s return value should become component state, such as a validation result or confirmation. | At the top level of the component or custom hook that owns the action. | Current action state, a dispatcher, and an isPending flag. |
useFormStatus |
A child control or status indicator needs information about its parent form’s submission. | In a component rendered inside the form being observed. | pending, submitted data, the form method, and the form action reference. |
The hooks are complementary: one exposes the action’s result as state; the other exposes the parent form’s submission status and details. See the official useActionState reference and useFormStatus reference.
As an Amazon Associate I earn from qualifying purchases.
Use useActionState to render an action result
The current reference signature is useActionState(action, initialState, permalink?). It returns three values: the current state, a dispatcher to pass to the form, and isPending. The initial state is used before the action has returned a value; each returned value becomes the next state.
Free tools Windows power users keep installed
One-click scans. No signup required.
import { useActionState } from 'react';
async function saveName(previousState, formData) {
const name = formData.get('name');
if (!name) {
return { error: 'Enter a name.' };
}
return { message: `Saved ${name}.` };
}
function NameForm() {
const [state, formAction, isPending] = useActionState(
saveName,
{ message: '', error: '' }
);
return (
<form action={formAction}>
<label>
Name
<input name="name" />
</label>
<button disabled={isPending}>
{isPending ? 'Saving…' : 'Save'}
</button>
{state.error && <p role="alert">{state.error}</p>}
{state.message && <p>{state.message}</p>}
</form>
);
}
Wrapping an action with useActionState changes its arguments: the previous state is first, and the action’s usual payload follows it. For a form action, that payload is the submitted FormData. If a function previously expected formData as its first argument, update its signature or it will read the wrong value.
#1 Best Overall
Return known failures; throw unexpected ones
For expected outcomes such as missing or invalid fields, return structured error information and render it from state. The React reference describes throwing for unexpected failures so the nearest Error Boundary can handle them. See React’s error-handling guidance for useActionState.
Use useFormStatus for a child component’s submission feedback
Import useFormStatus from react-dom. It takes no arguments and returns an object. A nested button can use pending to disable itself or change its label while its parent form is being submitted.
import { useFormStatus } from 'react-dom';
function SubmitButton() {
const { pending } = useFormStatus();
return (
<button type="submit" disabled={pending}>
{pending ? 'Submitting…' : 'Submit'}
</button>
);
}
function ContactForm({ action }) {
return (
<form action={action}>
<input name="email" type="email" />
<SubmitButton />
</form>
);
}
The component calling the hook must be rendered inside the form it observes. Calling useFormStatus in ContactForm, the same component that creates the <form>, does not track that form. Move the hook into a descendant such as SubmitButton. The React reference also documents data as submitted FormData or null, method as get or post, and action as the parent form’s function action reference or null in the documented cases.
Recommended Free Tools
Can a form use both hooks?
Yes. Use useActionState in the component that needs the returned result, and put a separate useFormStatus consumer inside the form if a nested control needs submission details. For example, the form owner can render a validation message from action state while a nested submit button disables itself during submission. If pending feedback is the only requirement, useFormStatus alone may be sufficient.
Rank #3
Server Functions, hydration, and permalink
In a framework scenario that supports React Server Components and Server Functions, React documents that a Server Function’s response can be shown before the page is hydrated. This is not a blanket guarantee for every client-only form.
The optional permalink argument to useActionState supports progressive enhancement on dynamic pages using a Server Function. If the form is submitted before JavaScript loads, the browser can navigate to that URL. The destination must render the same form component with the same action and permalink for React to pass the state through. After hydration, the permalink has no effect. Consult the useActionState reference for the documented conditions.
Rank #4
Understand queued actions and cancellation
useActionState queues calls so each action receives the state returned by the previous call. That ordering is useful when later submissions depend on earlier results, but sequential asynchronous work can take longer if many calls are queued. React suggests considering useOptimistic or, for more complex cases, cancelling queued actions or not using useActionState.
Cancellation is not a rollback: stopping client-side work does not undo a server-side mutation that has already happened. Cancel only when the side effect can safely be ignored or retried. See React’s guidance on queued actions.
Best Value
Which hook should you start with?
- Choose
useActionStateif you need to display or otherwise use the value an action returns. - Choose
useFormStatusif a descendant control or indicator needs submission status or details from its parent form. - Use both when the UI needs both an action result and separate feedback inside the form.
The current references describe these APIs without stating a minimum React version or a full framework compatibility matrix. Check the documentation for the React and framework setup you use rather than inferring a version requirement from the hook names.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




