Zustand or Jotai for a Dashboard app ?
The doc of the t3 stack talks about Zustand and Jotai in its other recommendations : https://create.t3.gg/en/other-recs
I am starting a project with the t3 stack (first time ^^) and it's my first time hearing about jotai and zustand. I am going to build a dashboard for data visualization, and there cannot be more than one route. I believe a state manager is great for this kind of app, but I see people saying to use jotai if the project is simple, and zustand if it is more complex. From your experience, when should you use these library ?
Create T3 App
Other Recommendations 🚀 Create T3 App
The best way to start a full-stack, typesafe Next.js app.
6 Replies
Jotai
Comparison — Jotai, primitive and flexible state management for Rea...
Jotai takes a bottom-up approach to global React state management with an atomic model inspired by Recoil. One can build state by combining atoms and renders are optimized based on atom dependency. This solves the extra re-render issue of React context and eliminates the need for memoization.
Try using no state manager until you actually run into specific issues that a state management lib would solve. 🙂 I've personally never found myself needing a state management lib. I have some cases where moving a data store from context to zustand would cut down some rerenders, but I won't actually move it until I measure a noticeable performance problem. React Query plus React built in hooks are fine to me.
I’ve used Zustand in a couple projects and always been pleased with it.
I use Valito
Jotai is simply a global useState that you can probably implement a bad version of it with useState & localStorage
go Zustand if you need to group operations with the state itself
Zustand /endthread