Module '"react"' has no exported member 'useOptimistic'.
Answered
American posted this in #help-forum
AmericanOP
Hello!
How can I resolve this issue? I'm found some people recommending pinning to "@types/react": "18.2.26", and I have tried that, but no luck.
I'm running next@14.1.0 and I'm using pnpm as my package manager
Module '"react"' has no exported member 'useOptimistic'.
How can I resolve this issue? I'm found some people recommending pinning to "@types/react": "18.2.26", and I have tried that, but no luck.
I'm running next@14.1.0 and I'm using pnpm as my package manager
Answered by American
Putting this in my
package.json solved it: "pnpm": {
"overrides": {
"@types/react": "18.2.66"
}
}7 Replies
@American Hello!
> Module '"react"' has no exported member 'useOptimistic'.
How can I resolve this issue? I'm found some people recommending pinning to "@types/react": "18.2.26", and I have tried that, but no luck.
I'm running next@14.1.0 and I'm using pnpm as my package manager
that hook is only on react canary and experimental
AmericanOP
Thanks, but Nextjs is using canary: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#optimistic-updates
do the same with the types
AmericanOP
Damn, I though that was gonna work but there are is no
@types/react@canaryAmericanOP
Putting this in my
package.json solved it: "pnpm": {
"overrides": {
"@types/react": "18.2.66"
}
}Answer