useFormStatus Must Be Inside the Form
You'll learn why useFormStatus can't read form state from the same component that renders the <form> element.
The Core Problem
useFormStatus works by reading context provided by React's <form> element — but here's the catch: the context is only available to descendants (children) of the form, not the component rendering the form itself.
If you try calling useFormStatus in the same component where you render <form>, it won't work. The hook will always return pending: false and no form data, because at that level in the tree, you're outside the form's context boundary.
Why This Happens
Think of it like a radio broadcast: the <form> element is the transmitter, sending out status signals. Components inside the form can tune in and receive those signals. But if you're standing right where the transmitter is being set up (the component rendering it), you can't receive the broadcast yet — you need to be in the coverage area (a child component).
// ❌ Won't work — same component as <form>
function MyForm() {
const { pending } = useFormStatus(); // Always false!
return (
<form action={myAction}>
{/* ... */}
</form>
);
}
// ✅ Works — inside the form
function MyForm() {
return (
<form action={myAction}>
<SubmitButton />
</form>
);
}
function SubmitButton() {
const { pending } = useFormStatus(); // Correctly reads form state!
return <button disabled={pending}>Submit</button>;
}
This architectural choice forces a clean separation: form logic stays in child components that truly need access to form state.
Key Takeaway: useFormStatus must be called in a component that's a child of the <form> element — it cannot be used in the same component that renders the form itself, because the context doesn't exist at that level.