Lets Talk about State Management
Hey everyone! I've recently developed my first relatively large application with T3 and started using Zustand for state management. I'm curious to learn about the best practices for state management and when it's appropriate to use local state (e.g., useState) versus Zustand.
Up until now, I've been using Zustand to avoid prop drilling and manage state across multiple components, and it's been working great. However, I haven't clearly defined in my mind when to choose between local state and Zustand. Any tips would be greatly appreciated!
Also i'm curious as to how updating the state management works with rebuilding and pushing projects. Is it just something that is taken care of in the background?
We're launching some community based apps in the near future and I'd like to try avoid as many issues as I can.
1 Reply
Server state goes into the React Quert/tRPC cache
Client state goes into useState as much as possible, and Zustand when useState isn’t doing the job anymore