Share states between two RecoilRoots #1906
Unanswered
ImperialFist
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone!
In my project, i'm using "react-three/fiber" which is required to store all content inside "Canvas". Also, for storing some states and share it with other modules in "Canvas" i'm using recoil's atom.
So, inside "RecoilRoot" everything works great, BUT i need to show data from atom in the "UI" component.
I can't put "RecoilRoot" out of "Canvas", so i tried to add a second "RecoilRoot". It kinda does the trick (now i can use "useRecoilValue" in "UI"), but it shows only default state of atom...
Here is how my "App.js" looks like:
Atom with data:
UI module:
So, how can i use atom values outside "RecoilRoot" or, at least, share from nested one?
Beta Was this translation helpful? Give feedback.
All reactions