The post has been translated automatically. Original language: Russian
I've tried different ways to manage the state: Redux, Zustand, MobX, Jotai, Recoil. Each tool solves the problem in its own way, and it's pointless to argue which one is “better”. The main thing is to understand where which one gives real benefits.
When I write on Redux
Redux is a reliable framework. It provides a strict structure, predictability, and transparent data. If the project is large, there are several teams in it, there are CI processes, review, audit, a bunch of asynchronous flows - Redux feels right at home.
Redux is good because it can bring order to chaos: events, states, and dependencies can be clearly described. It scales, it's easy to test, and it has great DevTools.
The price for this is time and a boiler plate. Sometimes there is too much code to just “add a checkmark".
When I take Zustand
Zustand is a different approach. Without cumbersome reducers, without unnecessary ceremony. One hook, a bit of logic, and the condition works. It is a tool for cases where speed and clarity are important.
In MVP, small applications, or isolated modules, it allows you not to inflate the architecture. The code remains readable and direct. Everything you need is under the hood: Devtools, persist, middleware. If desired, Zustand grows easily — the main thing is to keep stores atomic and write selectors carefully.
Performance and types
Zustand updates components sparingly. Redux can also work quickly, but it requires care with memoization. Both are friends with TypeScript, but in Zustand types are written more compactly, and Redux provides more guarantees at the template level.
The choice in production
- Zustand — when you need to quickly assemble a feature, make a prototype, an MVP, or a separate module. It is great for panels, configurators, and UI settings.
- Redux — when the code base is large, there are processes and standards, and it is important that every developer writes the same way.
I don't divide tools into “old” and “new" ones. Redux is about discipline and control. Zustand — simplicity and flow. And depending on the task, I'm comfortable using both.
Conclusion
The main thing is not “what to choose”, but why to choose.
Redux helps to build systems.
Zustand helps you move faster.
Я перепробовал разные способы управлять состоянием: Redux, Zustand, MobX, Jotai, Recoil. Каждый инструмент решает задачу по-своему, и спорить, какой “лучше”, бессмысленно. Главное — понять, где какой даёт реальную пользу.
Когда я пишу на Redux
Redux — это надёжный каркас. Он даёт строгую структуру, предсказуемость и прозрачные данные. Если проект большой, в нём несколько команд, есть CI-процессы, ревью, аудит, куча асинхронных флоу — Redux чувствует себя как дома.
Redux хорош тем, что можно навести порядок в хаосе: чётко описать события, состояния и зависимости. Он масштабируется, его легко тестировать, и у него отличные DevTools.
Цена за это — время и бойлерплейт. Иногда слишком много кода, чтобы просто “добавить галочку”.
Когда я беру Zustand
Zustand — другой подход. Без громоздких редьюсеров, без лишней церемонии. Один хук, немного логики, и состояние работает. Это инструмент для случаев, когда важны скорость и ясность.
В MVP, небольших приложениях или изолированных модулях он позволяет не раздувать архитектуру. Код остаётся читаемым и прямым. Под капотом — всё, что нужно: Devtools, persist, middleware. При желании Zustand легко растёт — главное держать стора атомарными и аккуратно писать селекторы.
Производительность и типы
Zustand экономно обновляет компоненты. Redux тоже умеет работать быстро, но требует внимательности с мемоизацией. С TypeScript оба дружат, но в Zustand типы пишутся компактнее, а Redux даёт больше гарантий на уровне шаблонов.
Выбор в продакшене
- Zustand — когда нужно быстро собрать фичу, сделать прототип, MVP или отдельный модуль. Отлично подходит для панелей, конфигураторов, UI-настроек.
- Redux — когда кодовая база большая, есть процессы и стандарты, и важно, чтобы каждый разработчик писал одинаково.
Я не делю инструменты на “старые” и “новые”. Redux — это дисциплина и контроль. Zustand — простота и поток. И в зависимости от задачи, я спокойно использую оба.
Вывод
Главное не “что выбрать”, а зачем выбирать.
Redux помогает строить системы.
Zustand помогает двигаться быстрее.