experimental_useOptimistic is not a function
Answered
Woodwasp posted this in #help-forum
WoodwaspOP
I'm trying to follow the guides for useOptimistic, but I continue to get an error that says
I can reproduce this in a fresh
Error: (0 , react__WEBPACK_IMPORTED_MODULE_3__.experimental_useOptimistic) is not a function.I can reproduce this in a fresh
create-next-app, but it goes away when I add serverActions to my experimental config. It does not go away when I do this on my own app. Anyone seen similar?Answered by Woodwasp
I figured it out! I was importing
useOptimistic in a server component and it gave me the generic failure to import error, rather than the one about importing interactiv elements into a server component.2 Replies
WoodwaspOP
I figured it out! I was importing
useOptimistic in a server component and it gave me the generic failure to import error, rather than the one about importing interactiv elements into a server component.Answer
WoodwaspOP
PR that maybe fixes this: https://github.com/vercel/next.js/pull/53313 (I couldn't get tests to run locally).