Comments on: Introducing Zustand (State Management) https://frontendmasters.com/blog/introducing-zustand/ Helping Your Journey to Senior Developer Mon, 25 Aug 2025 02:52:44 +0000 hourly 1 https://wordpress.org/?v=6.8.3 By: Magnus Vu https://frontendmasters.com/blog/introducing-zustand/#comment-38081 Mon, 25 Aug 2025 02:52:44 +0000 https://frontendmasters.com/blog/?p=6584#comment-38081 I hope we all can move to SolidJS one day.

]]>
By: Adam Rackis https://frontendmasters.com/blog/introducing-zustand/#comment-36226 Mon, 04 Aug 2025 15:30:24 +0000 https://frontendmasters.com/blog/?p=6584#comment-36226 In reply to Yashasavee.

Yep! Absolutely. The post was more about how these things compare out of the box but you’re of course right, and that’s how you’d optimize things if you were using context.

]]>
By: Yashasavee https://frontendmasters.com/blog/introducing-zustand/#comment-36113 Sun, 03 Aug 2025 10:38:55 +0000 https://frontendmasters.com/blog/?p=6584#comment-36113 Just a little suggestion – if someone is using context api and does not want to re-render the children components that are not using the state but just come between the creator and target component, they can wrap the in-between component with react memo.

]]>
By: Andi https://frontendmasters.com/blog/introducing-zustand/#comment-35427 Mon, 28 Jul 2025 08:55:16 +0000 https://frontendmasters.com/blog/?p=6584#comment-35427 In reply to W.

That’s why it’s called Zustand. Yes, Zustand is German for “state”, but in colloquial language it can also mean “mess” (Was für ein Zustand! = What a mess!).
Guess they picked that name for a reason, lol.

And do we still need a state management tool? We have server components now!

]]>
By: Glenn https://frontendmasters.com/blog/introducing-zustand/#comment-34972 Thu, 24 Jul 2025 13:20:04 +0000 https://frontendmasters.com/blog/?p=6584#comment-34972 Is there not the argument that with context memory is also short lived. i.e. With a state library like Zustand, moving away from an area of the app means you are still storing data in memory that does not need to be. We have been using context as way of managing this bloat and ensure state is short lived in the context or area required and not having to worry about prop drilling? Where we need state that is used Horizontally across the app and needs global persistence we currently use RTK. You thoughts on this?

]]>
By: Adam Rackis https://frontendmasters.com/blog/introducing-zustand/#comment-34924 Thu, 24 Jul 2025 06:34:38 +0000 https://frontendmasters.com/blog/?p=6584#comment-34924 In reply to Maikel D.

Hi! I think you’re talking about using SSR for data loading. If so, you’d use either RSC, TanStack, Remix, or whatever to load your data, and have it be available on the frontend via whatever constructs your SSR library has (loaders, whatever).

From there you probably don’t want to be putting those data into your Zustand store. Your server is probably going to be managing it, via whatever revalidation mechanism it has: server actions, etc.

I hope that helps at least a little. Zustand is for client-side state. You should be able to create a store with initial state on the server just fine. But yeah, trying to ram server-loaded data into the Zustand store is probably a bad idea

]]>
By: MohammadAzeem https://frontendmasters.com/blog/introducing-zustand/#comment-34922 Thu, 24 Jul 2025 06:20:25 +0000 https://frontendmasters.com/blog/?p=6584#comment-34922 My 2cents: It is true that set function can work with just passing the updated fields but works just one level deep.

You gotta use use immer.

]]>
By: Maikel D https://frontendmasters.com/blog/introducing-zustand/#comment-34915 Thu, 24 Jul 2025 05:03:24 +0000 https://frontendmasters.com/blog/?p=6584#comment-34915 I’m a big fan of Zustand and I love how you’ve dig into the ins and outs of the library and showcase how easy it is to implement and use.

I would love to hear your thoughts on integrating Zustand with SSR. In a lot of cases, I’d be using NextJS and would like to perform an initial call to the API to load some data and have it available on the client side within the same store.

I’ve seen and used one implementation, that works well, but it feels a little hacky. I’m curious to hear how you’d tackle this.

]]>
By: Mark https://frontendmasters.com/blog/introducing-zustand/#comment-34857 Wed, 23 Jul 2025 19:49:34 +0000 https://frontendmasters.com/blog/?p=6584#comment-34857 I’m interested to see what a vanilla solutions looks and preforms like without context. One thing that is good about “prop drilling” is that it makes dependencies very clear. Each component that needs some state has to either own it via useState()/useReducer() or get it passed into it from its parent. Creating tests and stories (e.g. Storybook) is now simpler (no context provider wrapping is needed nor any module mocking). I suspect that the simple prop drilling approach would lead to easier to read code (due to clear dependencies), more testable code, and code that performances just as well, maybe even better, than the Zustand-optimized version.

]]>
By: Taran Bains https://frontendmasters.com/blog/introducing-zustand/#comment-34772 Wed, 23 Jul 2025 05:34:42 +0000 https://frontendmasters.com/blog/?p=6584#comment-34772 Great post Adam!

In my day job, I’m using Redux, but it’s nice to see how other state management libraries do things, and I can see why Zustand is as popular as it is.

Granted, a lot of the apps I’m working on are legacy, and it might be overkill to introduce Zustand, but hey, I might just do it for shiggles. 😆

]]>