Can Jotai be used in order to replace the React Context API? #973
Replies: 1 comment 11 replies
-
Hi, our hope is to support all context use cases. We do have |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi team, I am trying to achieve the React Context behavior, and not sure if we can do that with Jotai.
Assuming we got a root component that receives data from props and passes down the data to its children. With React Context Provider, it can pass the data to the children in just 1 rendering cycle. I am not sure if we can do that (or if we should do that) with atoms.
Currently, Jotai provider only handles initial values, and there is no API (that I can see) to change the value in 1 render cycle. The only way to work it out is, changing the atom value on side-effect when the root component receives new data.
Am I missing anything? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions