Say hello to `React.useActionState`

While reading the release notes for React 19 RC, I was thrilled to see the addition of a new hook, useActionState.

This hook renames useFormState, moves it from the react-dom package to the core react package, and adds an additional return value that indicates the pending status of the returned server action. This hook is critical when writing any code that interacts with Next.js Server Actions.

I was thrilled not just because it’s the exact change I suggested the last time I wrote about useFormState, but also because my post was cited in the PR introducing the change! I’m stoked to replace my home-baked solution with this built-in API, and I’ll be updating my previous post to point to the new solution.

I owe a proper “thank you” to Ricky Hanlon, who took my feedback and introduced this change. Thanks, Ricky!