Struggling to Choose a State Management Library in React
So far, for small projects, useState + useContext has been sufficient. But now that I'm building a somewhat larger app, I'm torn between Redux Toolkit, Zustand, and Jotai. I'm hesitant about Redux because I've heard it has a steep learning curve and a lot of boilerplate. Zustand seems lightweight, but I'm worried that its smaller community might leave me stranded if issues arise. Jotai is gaining traction as a Recoil alternative, but I'm not sure if it's stable enough yet. I'd appreciate advice from anyone who has used these in production.
4 answers
I highly recommend Zustand. I had similar concerns and ended up choosing Zustand, and the learning curve is almost nonexistent while the code is very intuitive. Although the community is relatively small, the official documentation and examples are well put together, so I had no trouble solving issues when they came up. Redux definitely has a lot of boilerplate, which can be a significant overhead for small teams.
I had similar concerns and used Redux for over a year, but recently switched to Zustand... The code definitely shrank to about a third of its original size. However, for really large-scale projects, Redux's strict patterns can actually help with team collaboration. If you have time, I'd recommend building a simple to-do list with each to help you decide.
I'm using Redux Toolkit, and these days createSlice has significantly reduced boilerplate. For larger apps, Redux DevTools debugging is really powerful, making it great for long-term maintenance. Zustand isn't bad either, but there are times when state tracking feels inconvenient. Choose based on your project size and whether your team can handle the learning curve.
I've been trying out Jotai, and it's definitely lighter and more stable than Recoil. It works well with React 18's concurrent mode, and since it breaks things down into atom units, re-rendering optimization comes naturally. However, if you have complex business logic, the lack of middleware support is a downside. For small-scale projects, Zustand is a solid choice, while Redux Toolkit works well for medium to large-scale ones.