-
I want to manually call Zustand
** Edited
useEffect(()=>{
// do some check to see if we need to rehydrate store
// @ts-expect-error
void userCollectionsStore.useStore().persist.rehydrate() // Error: Invalid hook call.
}) |
Beta Was this translation helpful? Give feedback.
Answered by
zbeyens
Aug 3, 2022
Replies: 1 comment
-
The hook needs to be called outside const store = userCollectionsStore.useStore()
useEffect(()=>{
// do some check to see if we need to rehydrate store
// @ts-expect-error
store.persist.rehydrate() // Error: Invalid hook call.
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
zbeyens
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The hook needs to be called outside
useEffect
, can you try this: