Replies: 2 comments
-
@gutisalex sure, let me explain you few things:
|
Beta Was this translation helpful? Give feedback.
-
ok but is it completely wrong how I implement it when using create? I basically have a store and a client component that uses a useEffect to trigger an init function, that function then sets a loading state and fetches all the data I need, like cookies and api stuff, when finish I reset the loading. Other components which depend on that data I use the loading state to show a loading skeleton (just a wrapper that blurs the component). So the initialisation happens in a useEffect which definitely goes to the client. Having an isolated store would not help me much here, I need one store for several components. What does "not sharing data across multiple requests." exactly mean? |
Beta Was this translation helpful? Give feedback.
-
hey, first off... Zustand is amazing! Having an absolute blast using it... first statemanagent I use that is clean, easy to understand and small in size!!
I have a nextjs application which renders the most of the page prerendered. However I have some client components for which I use zustand. I have one component that has a form which takes some user data and then calls an API for some information according to the inputs. I store the information in zustand because I need it on several other client components. Thats pretty much it...
Ok now to my question: Apparently there are two ways how to create a store both described in the docs. One with create and one with createStore (next specific). I used create for mine and everything works fine so far. But is there something I am missing here? In the next docs stays I should not use a global store, but I kinda do that right? Is there any issue with what I need the store for? Or am I good?
Beta Was this translation helpful? Give feedback.
All reactions