Replies: 1 comment
-
|
Hey @gutisalex, The error you're encountering is due to calling the To resolve this issue, you should refactor your code to ensure that the If you need to access store values outside of components, consider using the Here's an example of how you can structure your code to use the import { useShallow } from 'zustand';
const useCustomHook = () => {
const store = useShallow(storeSelector);
return store;
};
const MyComponent = () => {
const store = useCustomHook();
// Use store values here
return <div>My Component</div>;
};By following this pattern, you can ensure that hooks are used correctly within your Next.js application. Hope this helps! If it solves your issue, could you please mark this comment as the answer? It helps others find the solution faster. 🙏 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
hey, I followed along on how to create stores for nextjs and then I found your howto for autogenerating selectors... first off is that possible to have that, too?
When I started to implement the function I already get an error inside the createSelectors function on useStore:
React Hook "useStore" is called in function "(store.use as any)[k]" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".
Beta Was this translation helpful? Give feedback.
All reactions