Recommend zustand for global state management#715
Recommend zustand for global state management#715MalcolmTomisin wants to merge 1 commit intomainfrom
Conversation
MalcolmTomisin
commented
Sep 13, 2024
- Zustand has a similar API to Redux (Selectors etc)
- Way less boilerplate
- Growing popularity as Redux's gets limited to legacy codebases
- New projects get set up with new generation state managers (Tanstack-query, Valtio, MST, Zustand)
- Zustand is lighweight, lightweight is important for React Native
- Performant with transient updates that don't cause re-renders
|
Is the mobile team using Zustand a lot? I've never worked with it. I'd love to see how we're using it on our client work. |
|
@pangolingo I don't think there has been opportunities to experience Zustand on client work. New projects are more likely to use zustand. |
|
I suggest that we convert this PR to a draft, and don't merge until until more thoughtbotters have enough first-hand experience to recommend Zustand over Redux. |
|
Hi @pangolingo, yeah I like that suggestion. Ideally, we should get more experience with Zustand and adoption on client projects before changing the guide. @MalcolmTomisin I really liked the idea of writing a blog post about comparing both. |
React Native apps package all code into a single bundle which means the impact on lightweight library is very minimal.
I'm ready to be on the side of redux with this and fight you :)
We use Ruby on Rails as our web stack which is 20 years old, stable and just works. While we should focus on adopting modern solutions, instead of chasing them, we should be carefully choosing them. I think we should be introducing new libraries in a client project first to test suitability, identify problems, and gather team feedback before recommending broader adoption such as updating our guides. |
|
@MalcolmTomisin it's been 1.5 years and I have still not used Zustand. In fact I've barely used any state management except React context. Has anyone else used Zustand enough to recommend it? If not, we should close out this PR. |