Open derolf opened 5 months ago
Imagine we had
const [get, getCallback] = useRecoil();
where get and getCallback have the same semantics as in the getter of selector.
get
getCallback
selector
Then I could write:
function Foo() { const [get, getCallback] = useRecoil(); return <>{get(myAtom)} <button onClick={() => getCallback(({i}) => i.set(myAtom, 42))}>42</button></> }
what was the motivation behind this?
The motivation is to avoid value/state-hooks for every piece the component is using.
Imagine we had
where
get
andgetCallback
have the same semantics as in theget
ter ofselector
.Then I could write: