-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage of Recoil in Nextjs app (turborepo) induces a TypeError: Cannot destructure property 'ReactCurrentDispatcher. #66695
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Commenting here as well: I was facing the same issue, finally found what was wrong.
Turbo will now install recoil in the root folder node_modules alongwith all other dependencies/libraries and make it available for those that added it as a dependency. |
I got your comment. Thanks. I will respond to you if these steps are working. |
It didnt work for me. |
This comment has been minimized.
This comment has been minimized.
Had the same issue I solved it by adding a new nextJS project with "pnpx create-next-app@latest" in my apps folder |
They also mentioned this in here https://nextjs.org/blog/next-15-rc : |
To make it work in your current directory: |
Recoil is not compatible with React 19 facebookexperimental/Recoil#2318 |
If the Next.js version you're using is 14 or higher, downgrade it to 13. |
do not use react 19 or higher |
Link to the code that reproduces this issue
https://github.com/tsdineshjai/PayTM_Repo
To Reproduce
Current vs. Expected behavior
I have added store as package in the turborepo, which contains Recoil as state management. A hook named "useBalance" was added, which returns the state of an atom.(basic unit of recoil). Exported the hook file. Added the "store" package as dependency to the Next.js app.
The issue arises whenever I try to invoke "useBalance" hook in the Next.js app.
The expected result should be a text on the page showing "the balance is 0", instead we get a unhandled runtime error.
Provide environment information
Which area(s) are affected? (Select all that apply)
Not sure, Output (export/standalone)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I have already raised the issue in turborepo GitHub repo as a discussion, assuming this is an issue related to turborepo.
link: vercel/turborepo#8373
I have been redirected here to post as an issue to get a guidance on the issue.
Note : There is no issue for the same code if it's a standalone application of turbopack. But it arises while using it in monorepo.
The text was updated successfully, but these errors were encountered: