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.
If I have a basic atom with a .default initialiser, is it possible/canonical to access that atom's default from a selector or atom effect?
constdataAtom=atom({key: 'myData',// How do you access this if you need it?default: 'hello'})// some other PSEUDO code showing a toy usage:()=>{const theData =get(dataAtom)// The missing step...consttheDataDefault=someMagicalDefaultAccessor(theData)if(theDataDefault==='hello')launchTheMissiles()elsedoTheOtherThing()}
This isn't about resetting using useResetRecoilState(), it's closer to something like useRecoilDefaultValue()
An accessor like get(myAtom).defaultValue() is kinda what I'd expect, but is there some other canonical way to get to this default that I've missed?
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
-
If I have a basic atom with a
.default
initialiser, is it possible/canonical to access that atom's default from a selector or atom effect?This isn't about resetting using
useResetRecoilState()
, it's closer to something likeuseRecoilDefaultValue()
An accessor like
get(myAtom).defaultValue()
is kinda what I'd expect, but is there some other canonical way to get to this default that I've missed?Beta Was this translation helpful? Give feedback.
All reactions