[Question] Where do atoms and derived atoms values 'live'?
See original GitHub issueHi @dai-shi, first of all thank you for this library. It is great to have different options, approaches and improvements around the React state topic. Good job!
I’m playing a bit with it and trying to better understand what’s happening under the hood, which use cases can be easily covered with jotai and which doesn’t (if any). And several questions arised. I didn’t check code yet, sorry, so my questions are based on guessing.
My first assumption when I saw the Provider
wrapping the tree:
<Provider>
<App />
</Provider>
and also based on this quote:
If you need React Context alternatives, Jotai comes with enough features
was to think that:
- Provider is kind of a contextual store where all the atom values live. Is that correct?
Also, for learning/debug purposes:
- Is there a way we can check atom values directly from its “store” without consuming them? Similar to what Redux DevTools offer.
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (12 by maintainers)
Top Results From Across the Web
Matter, elements, and atoms | Chemistry of life (article)
The protons (positive charge) and neutrons (neutral charge) are found together in the tiny nucleus at the center of the atom. The electrons...
Read more >Atoms and Elements | Biology for Majors I
Atoms are made up of protons and neutrons located within the nucleus, with electrons in orbitals surrounding the nucleus. Protons and neutrons have ......
Read more >Atoms, Molecules, and Ions
In the fifth century BC, Leucippus and Democritus argued that all matter was composed of small, finite particles that they called atomos, a...
Read more >Atom | Definition, Structure, History, Examples, Diagram, & Facts
atom, smallest unit into which matter can be divided without the release of electrically charged particles. It also is the smallest unit of...
Read more >What is an atom? Definition and Structure
Protons and neutrons are subatomic particles that make up the center of the atom, or its atomic nucleus. A proton is positively charged....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Exactly, that was one of the proposal. The other one was to being able to assign atoms to a certain Provider, so you can completely mimick React Context and place Providers wherever you want along with its atoms.
It can be harsh to understand and use it, I agree. It is a trade off, the more flexibility you offer, the more powerful the library would be. The less flexibility the easier to use although with limitations.
I am just trying to think what would happen with typical scenarios and check if jotai suits my needs. That’s what I am suggesting all this ideas. It doesn’t have to be like that, of course. I just find useful this kind of debate to be aware of possible limitations and solutions
Note that #640 changed the scope api a bit differently. (the internal is the same.) You are welcome!