Next.js · Middle · Question 41 of 75
Why is useFormStatus handy in forms with Server Actions?
- ✓Correct answer: It gives the parent form's
pendingstate so you can disable the button - 2It returns the validation result of each form field
- 3It lets you submit the form programmatically, without a button or click
Explanation
The hook is called in a component inside <form> (usually the submit button): const { pending } = useFormStatus(). This lets you build a reusable <SubmitButton>. The action's result and errors are held by useActionState.