Replies: 1 comment
-
|
If you are using props, it has to be a hook. const useInspectCache = ({ path, nestedIndex }) => {
const derivedAtom = useMemo(() => atom((get) => {
const target = nestedIndex === undefined
? path.join('.')
: `${path.join('.')}[${nestedIndex}]nt`
return get(inspectCacheAtom)[target]
}), [path, nestedIndex])
return useAtomValue(derievedAtom);
}
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm replacing
zustandtojotai(PR).In this code, seems that parameter are passed to get of state.
It's similar to selectorFamily (recoil).
zustandcode:I did some tries, but none correctly work:
Maybe should be used some Custom useAtom hooks.
Beta Was this translation helpful? Give feedback.
All reactions