React
State Management
Tech
State Management: Redux vs Zustand
---
The Redux Era
Long time ago, everyone use Redux. You want to change one boolean, you need to create Action, Reducer, Store, Provider... aiyoh, write until hand tired.
But Redux is solid. For very big app like banking or e-commerce, Redux is still king. It's strict, predictable, and devtools power gila.
Enter Zustand (The Bear)
Zustand is like the chill younger brother.
const useStore = create((set) => ({
bears: 0,
increasePopulation: () => set((state) => ({ bears: state.bears + 1 })),
}))
See? So simple. No provider wrapping, no complex boilerplate. Just create and use.
Which one I use?
For 90% of my projects, I use Zustand. It's lightweight and fast. Unless you building the next Facebook, usually no need Redux one. Keep it simple, stupid (KISS).