Heavy Redux user here, why should I migrate to Zustand? #3354
Replies: 1 comment 7 replies
-
|
I think the loop in the image you shared is already basically how React works, even without any state management library. In React, user actions update state, React notices the change, and then re-renders the relevant components to update the UI. So in a way, the data loop already exists as part of React itself. From there, the interesting question (at least to me) is: Personally, I don’t think single source of truth has to mean a single store. Even with multiple stores, as long as each piece of data has one clear, authoritative place in the app, that still feels like a single source of truth to me. As apps grow, state naturally splits into different domains. In Redux, putting everything into one store can sometimes make things more complex over time. With Zustand, you can split state by domain, create multiple stores, and compose them pretty easily. That flexibility is why I tend to prefer Zustand — it keeps the “single source of truth” idea per domain, while scaling in a way that feels more natural to me. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hallo Leute (= folks)
(Zustand is German, and I speak German too. Are the Zustand inventors Germans?)
Anyway, I'm planning to refactor the (Videomail-Client)[https://https://github.com/binarykitchen/videomail-client] to use either Redux or Zustand. I just can't decide. Hence, the discussion here ...
I come from a Clojure world and totally like (re-frame)[https://github.com/day8/re-frame] which keeps a strict, single source of truth:
Source: https://day8.github.io/re-frame/a-loop/#the-data-loop
This picture says it all: any change comes with consequences, state changes. This centrally.
I haven't seen any JS-based library matching with this ideology.
If you want to run an app from anywhere, desktop or mobile, display the username while the user renames it, do you really want to update it in multiple stores or in one central place?
Thanks for your thoughts and feedback 😎
Beta Was this translation helpful? Give feedback.
All reactions