State management with NextJS 13
Unanswered
Persian posted this in #help-forum
PersianOP
Is it a good choice to use Redux or zustand for state management or is there a better option to use
9 Replies
Broad-snouted Caiman
Depends. If you’re using the app directory, then you may not even need a global state manager. I’ve used both in production and my takeaways are this:
- Redux has the larger community and more examples to pull from, but more complex to set up.
- Zustand is more lightweight and simple to use, but is definitively newer than Redux so there may some edge cases that aren’t as well documented.
Having used both, I personally prefer Zustand but I don’t think you can go wrong with either.
- Redux has the larger community and more examples to pull from, but more complex to set up.
- Zustand is more lightweight and simple to use, but is definitively newer than Redux so there may some edge cases that aren’t as well documented.
Having used both, I personally prefer Zustand but I don’t think you can go wrong with either.
I also vote neither. Global state management is really a non-issue with server components.
@Marchy I also vote neither. Global state management is really a non-issue with server components.
European pilchard
I have to be doing something wrong because I can’t get other server components to share values and update. Is there some built in state management or something?
@DirtyCajunRice | AppDir yep. its called searchParams and cookies 🙂
European pilchard
I didn’t think of cookies at all lol
I could set a cookie and access it pretty much anywhere I think
On the server
Broad-snouted Caiman
@European pilchard both of these videos are helpful in explaining how to use Zustand/Redux with server components. Hydration is key in RSCs:
https://youtu.be/OpMAH2hzKi8
https://youtu.be/dRLjoT4r-jc
https://youtu.be/OpMAH2hzKi8
https://youtu.be/dRLjoT4r-jc
PersianOP
Thanks you all :)