The result of getSnapshot should be cached to avoid an infinite loop #1936
-
I'm new to zustand. I've got my basic functionality working, but I'm seeing this warning coming from
The stack trace is not very helpful, but I'm not directly using Is this a zustand bug or should I be scrutinizing my own code more? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Are you creating a fresh store in render function? |
Beta Was this translation helpful? Give feedback.
-
my suggestion would be to use "useShallow" Docs const [blah] = useMyStore(useShallow((state) => [state.blah])); |
Beta Was this translation helpful? Give feedback.
Thank you, I figured it out. The problem was that I was using
useX
callbacks to get around some eslint errors about the use ofuseX
hooks outside react components. The actual solution was: