Next.js Discord

Discord Forum

Next.js 14 breaks with experimental_useFormStatus is not a function

Answered
Giant Angora posted this in #help-forum
Open in Discord
Giant AngoraOP
In our Next.js 13 app we use useFormStatus from react-dom. When I upgrade Next.js to 14.0.4, the app breaks with
TypeError: (0 , react_dom__WEBPACK_IMPORTED_MODULE_1__.experimental_useFormStatus) is not a function
...
> 16 |     const { pending } = useFormStatus();
     |                                     ^


I tried upgrading react-dom to the next or canary versions without success.

Is there a way to make this work with Next.js 14?
Answered by Giant Angora
I just worked it out - it's the @types/react-dom version, which was incorrect. With that set to latest TS complains and correctly tells me that I need to import useFormStatus instead of experimental_useFormStatus.
View full answer

2 Replies

install @types/react-dom@latest
Giant AngoraOP
I just worked it out - it's the @types/react-dom version, which was incorrect. With that set to latest TS complains and correctly tells me that I need to import useFormStatus instead of experimental_useFormStatus.
Answer