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
-
I'm replacing
zustand
tojotai
(PR).In this code, seems that parameter are passed to get of state.
It's similar to selectorFamily (recoil).
zustand
code: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