useFormStatus
The status of the <Form> a component is inside: pending state and target.
The status of the <Form> a component is inside: pending state and target. Outside a form it reports
not pending.
Import#
ts
import { useFormStatus } from "@shadow-js/dusk/client";
Signature#
ts
function useFormStatus(): FormStatus
Returns#
The status of the nearest form.
Examples#
ts
function SubmitButton() {
const status = useFormStatus();
return <button type="submit" disabled={status.pending}>{status.pending ? "Saving" : "Save"}</button>;
}