Back to blog

Modern State Management in 2025: Why Zustand and Jotai Are Surpassing Redux

Hello HaWkers, for years Redux was the gold standard for state management in React. But in 2025, developers are abandoning Redux en masse for simpler and more modern solutions.

Zustand and Jotai represent a new generation of state management: less boilerplate, better performance, and superior developer experience.

The Problem with Redux

// Redux - Too much boilerplate for something simple
// actions/counter.js
export const INCREMENT = 'INCREMENT';
export const DECREMENT = 'DECREMENT';

export const increment = () => ({ type: INCREMENT });
export const decrement = () => ({ type: DECREMENT });

// reducers/counter.js
const initialState = { count: 0 };

export default function counterReducer(state = initialState, action) {
  switch (action.type) {
    case INCREMENT:
      return { ...state, count: state.count + 1 };
    case DECREMENT:
      return { ...state, count: state.count - 1 };
    default:
      return state;
  }
}

// store.js
import { createStore, combineReducers } from 'redux';
import counterReducer from './reducers/counter';

const rootReducer = combineReducers({
  counter: counterReducer
});

export const store = createStore(rootReducer);

// Component.jsx
import { useSelector, useDispatch } from 'react-redux';
import { increment, decrement } from './actions/counter';

function Counter() {
  const count = useSelector(state => state.counter.count);
  const dispatch = useDispatch();

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => dispatch(increment())}>+</button>
      <button onClick={() => dispatch(decrement())}>-</button>
    </div>
  );
}

// 6 files, ~60 lines for a counter! 😱

Zustand: Extreme Simplicity

// store/counter.js - ALL state management in one file!
import { create } from 'zustand';

export const useCounterStore = create((set) => ({
  count: 0,
  increment: () => set((state) => ({ count: state.count + 1 })),
  decrement: () => set((state) => ({ count: state.count - 1 })),
  reset: () => set({ count: 0 })
}));

// Component.jsx
import { useCounterStore } from './store/counter';

function Counter() {
  const { count, increment, decrement } = useCounterStore();

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={increment}>+</button>
      <button onClick={decrement}>-</button>
    </div>
  );
}

// 2 files, ~20 lines. Much simpler! ✨

Jotai: Atomic State Management

// atoms/counter.js
import { atom } from 'jotai';

// Primitive atoms
export const countAtom = atom(0);

// Derived atoms (computed)
export const doubledCountAtom = atom((get) => get(countAtom) * 2);

// Component.jsx
import { useAtomValue } from 'jotai';
import { countAtom, doubledCountAtom } from './atoms/counter';

function Counter() {
  const count = useAtomValue(countAtom);
  const doubled = useAtomValue(doubledCountAtom);

  return (
    <div>
      <p>Count: {count}</p>
      <p>Doubled: {doubled}</p>
    </div>
  );
}

Comparison: Redux vs Zustand vs Jotai

Feature Redux Zustand Jotai
Bundle Size ~40 KB ~1.2 KB ~2.8 KB
Boilerplate High Low Medium
Learning Curve Steep Smooth Medium
Performance Good Excellent Excellent
DevTools Yes Yes Yes
Persistence Middleware Built-in Extensions
TypeScript Complex Simple Excellent
Async Thunks/Saga Native Native

When to Use Each

Use Zustand when:

βœ… Want maximum simplicity
βœ… Simple to moderate global state
βœ… Need easy persistence
βœ… Coming from Context API
βœ… Small/medium team

Use Jotai when:

βœ… Prefer atomic state
βœ… Need complex derived state
βœ… Suspense and async are important
βœ… Fine-grained reactivity
βœ… Influence from Recoil/atoms

Use Redux when:

βœ… Large enterprise project
βœ… Time-travel debugging essential
βœ… Redux ecosystem necessary
βœ… Team already masters Redux
βœ… Extremely complex state

If you want to better understand modern React trends, check out: Svelte 5 Runes: The Reactivity Revolution where we explore how modern frameworks are reimagining state management.

Let's go! πŸ¦…

πŸ’» Master JavaScript for Real

The knowledge you gained in this article is just the beginning.

Payment options:

  • $4.90 (single payment)

πŸ“– View Complete Content

Comments (0)

This article has no comments yet 😒. Be the first! πŸš€πŸ¦…

Add comments