Replies: 1 comment
-
Sorry, I didn't mean to post this discussion in your repo, I'm an idiot. |
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
-
Hi folks,
I'm using zustand in order to initialize the state in a Next.js app with RSC.
To do that, I followed the guide in your docs, in particular: https://docs.pmnd.rs/zustand/previous-versions/zustand-v3-create-context#migration
However, with
useStore(store, selector)
is not possible to use the.getState()
from the hook, and so it is not possibile to set a state outsite a react component:In this case
useUserContext(state => state)
throw the common error: "Error: Invalid hook call. Hooks can only be called inside of the body of a function component" because it is outside of a RC, and it does not have.getState()
.Is there a way to retrieve the state outsite of a RC if we are using React context?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions