Skip to content
Discussion options

You must be logged in to vote

Hey @gutisalex,

The error you're encountering is due to calling the useStore hook inside a function that is not a React component or a custom hook. In React, hooks like useStore must be called directly inside functional components or other custom hooks.

To resolve this issue, you should refactor your code to ensure that the useStore hook is only called within React components or custom hooks. Avoid calling hooks inside regular functions or loops.

If you need to access store values outside of components, consider using the useShallow hook or restructuring your code to encapsulate the logic within a custom hook that can be used in components.

Here's an example of how you can structure your …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gutisalex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants