Initial atom state
See original GitHub issueCurrently the most issue I see with atoms is initial atom state which especially on server cant be inside any global objects ie localStorage etc. (setEffect is not working on server too)
Creating atoms and passing them through a context - loss of main advantages (u would need to create dependent atoms in context etc)
Probably passing Provider value to atom on initial call could solve this?
I.e.
// atom already have getter fn as param so I call atom with state dependent on context subatom.
const myAtom = subatom(ctx => ctx.someVal)
....
// in some component
<InitialJotaiValueProvider value={{ someVal: 123 }}> ...
Or probably some other beautiful api can be available.
PS: Api like above can be typed well like
const { InitialValueProvider, subatom} = createBlaBla<ValueType>()
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Initializing Atom State on Render - Jotai
There are times when you need to create an reusable component which uses atoms. These atoms' initial state are determined by the props...
Read more >atom(options) - Recoil
An atom represents state in Recoil. The atom() function returns a writeable RecoilState object. ... default - The initial value of the atom....
Read more >What is the initial excited state of the atom? - Toppr
The quantum number n corresponding to the excited state of He+ion if on transition to the ground state that ion emits two photons...
Read more >Atom - Wikipedia
The nucleus is made of one or more protons and a number of neutrons. Only the most common variety of hydrogen has no...
Read more >A hydrogen atom is in the initial state { n_i = n }, where n1. A ...
Answer to: A hydrogen atom is in the initial state { n_i = n }, where n1. A. Find the frequency of the...
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
You are welcome!
For someone interested, it’s like this.
#158 added
shouldRemove
. There can still be casesweakAtomFamily
works better. We can add it to utils if someone suggests some use cases.For now, I don’t think we have any actions for this issue, so closing this.