You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
<RecoilRoot># root store to store a state ‘A’ which is globally used in the whole app.<div>
...
</div><ul><li><RecoilRoot># nested store to store states that are only used in each `li` component.
...
... <=== here
...
</RecoilRoot></li><li>
...
</li>
...
</ul></RecoilRoot>
Somehow I ended up needing to set the state A in the components wrapped in the nested RecoilRoot (marked as 'here').
However Recoil only updates A in the nested RecoilRoot even though A is a globally used state. Which means state A can have different values across RecoilRoot levels.
Is there a way to control in which level of RecoilRoot to update a state?
or
Is there a way to bound specific states to a specific RecoilRoot so that each state is guaranteed to be stored in one RecoilRoot with a single value?
Without these sort of feature, I think Multi <RecoilRoot> is dangerous since every component cannot trust the global state without knowing the whole structure of nested RecoilRoots.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Somehow I ended up needing to set the state
A
in the components wrapped in the nested RecoilRoot (marked as 'here').However Recoil only updates
A
in the nested RecoilRoot even thoughA
is a globally used state. Which means stateA
can have different values across RecoilRoot levels.Is there a way to control in which level of RecoilRoot to update a state?
or
Is there a way to bound specific states to a specific RecoilRoot so that each state is guaranteed to be stored in one RecoilRoot with a single value?
Without these sort of feature, I think Multi
<RecoilRoot>
is dangerous since every component cannot trust the global state without knowing the whole structure of nested RecoilRoots.Thank you.
Beta Was this translation helpful? Give feedback.
All reactions