useFormState's isPending is always undefined
Answered
Sphecid wasp posted this in #help-forum
Sphecid waspOP
Title. I'm using Next 14.2.4 and React 18.3.1. When I inspect the type on useFormState it says that there should be a third value in the array, isPending, but whenever I log it out in the console it's always undefined.
Answered by Lakeland Terrier
useFormState only takes two values. To use an isPending status you need to use useFormStatus as well.
https://react.dev/reference/react-dom/hooks/useFormStatus
useActionState is what useFormState has been rebranded to in React19 and it accepts that third isPending value.
https://react.dev/reference/react-dom/hooks/useFormStatus
useActionState is what useFormState has been rebranded to in React19 and it accepts that third isPending value.
1 Reply
Lakeland Terrier
useFormState only takes two values. To use an isPending status you need to use useFormStatus as well.
https://react.dev/reference/react-dom/hooks/useFormStatus
useActionState is what useFormState has been rebranded to in React19 and it accepts that third isPending value.
https://react.dev/reference/react-dom/hooks/useFormStatus
useActionState is what useFormState has been rebranded to in React19 and it accepts that third isPending value.
Answer