Skip to content

State Management in React: Redux Toolkit, Lightweight Stores, MobX

When state is truly app-wide, the tool question comes up – Redux Toolkit, a lightweight store such as Zustand or Jotai, or the reactive model of MobX. But why this choice only comes after the counter-check, and usually turns out smaller than expected.

≈ 11 min readSoftwareFrontendReact

State Management in React: Redux Toolkit, Lightweight Stores, MobX

A global store is not part of the basic equipment of a React application. It’s the exception you have to justify. That’s what the React overview said, where the question of ownership was the focus – where does a piece of state belong? What remained open there was what to use when a piece of state actually passes the justification, that is, when it really is app-wide. I had promised the comparison. Here it is.

Editorial note (July 2026): The tools part is a snapshot from October 2021: Redux Toolkit 1.x, Zustand 3.x, Jotai 1.x and MobX 6. The more important separation is less transient: URL state, server cache and your own client state have different owners. Current versions can change the ergonomics, not these responsibilities.

Before we talk about tools, though, I have to hit the brakes. The question “Redux, Zustand or MobX?” is usually asked much too early – at a point when it isn’t even clear whether a store is needed at all. On closer inspection, the supposedly global state often turns out not to be global at all. That’s why the counter-check comes first, and only then the actual comparison.

Not every kind of state needs the same storage. The choice starts with ownership, lifetime and the need for synchronization.

Classifying state by responsibility

  • Owner · one component or a limited subtree
  • Lifetime · tied to the rendering
  • Examples · open dialog and input focus
  • Owner · several areas of the UI
  • Lifetime · within the application session
  • Examples · local selection and unsaved work in progress
  • Owner · backend or domain system
  • Lifetime · independent of the browser
  • Examples · records, permissions and approved revisions

The matrix doesn’t recommend a library. First of all, it keeps server data from being treated like local state, or short-lived UI details like global domain objects.

The counter-check first#

In a project that “absolutely needed a global store,” we first wrote down everything that was supposed to go into it – and then started crossing things out. A surprisingly large part of it was really URL state: filter, page, selection or tab, insofar as they should be shareable, navigable or bookmarkable. Short-lived display details may stay local. A store that additionally holds navigable values, on the other hand, easily builds up a second truth next to the address.

The next big block is even trickier, because it looks like state and feels like state: loaded data. The list of invoices, the user profile, the search result. These are cache copies of something whose truth belongs to the backend. That calls for server cache semantics such as keys, freshness, invalidation and error states – whether a specialized library provides them or, say, RTK Query within the Redux store. The problem isn’t the physical storage location but a hand-managed slice that rebuilds these semantics.

Take these two blocks out – navigable state into the address, server data into a cache – and often little is left. The real app-wide client state can be a small core: theme, language, a local draft or a shopping cart, insofar as its truth really lives in the client. Identity and permissions, on the other hand, usually come from the server; locally there is only their cache copy. For the remaining core, a store pays off, and because this core is small, the tool may be small too.

flowchart TB
  Start["A value that looks like<br/>global state"]
  Start --> Global{"Really app-wide,<br/>or only needed locally?"}
  Global -->|only one corner| Lokal["useState / useReducer<br/>in the component"]
  Global -->|app-wide| URL{"Does it belong in the URL?<br/>filter, page, selection"}
  URL -->|yes| Adresse["Router / URL<br/>shareable, survives reload"]
  URL -->|no| Server{"Does the truth belong<br/>to the backend?"}
  Server -->|yes| Cache["Server cache<br/>TanStack Query / SWR"]
  Server -->|no| Store["Real core: only<br/>now choose a store"]

Everything depends on the order. If you start with the tool question, you fill the store with things that have no business being there and later wonder about synchronization bugs. If you start with the counter-check, you often get by with useState and the URL and don’t need a store at all. Only when a core remains after crossing things out is the rest of this post worth it.

Three families for the real core#

Suppose this core exists. Then there are roughly three schools of thought on how to hold app-wide state. I show each with a tiny example and say honestly what it costs – because none of them is free.

Redux Toolkit: the classic model, slimmed down#

Redux has a clear model: there is exactly one store, one central state tree. You never change it directly; you send actions – descriptive messages such as “increment” – and pure functions called reducers compute the new state from the old state plus the action. For years, this model earned Redux a reputation for being cumbersome: lots of ceremony, action types as constants, boilerplate for every little move.

Redux Toolkit – RTK for short, today the officially recommended way to write Redux – takes exactly this ceremony away. A createSlice bundles state, actions and reducers in one piece. The reducer code is remarkable: it looks as if you were mutating the state directly, but it stays immutable internally, because RTK uses the Immer library, which turns the apparent mutations into a clean new copy.

import { configureStore, createSlice } from "@reduxjs/toolkit";

const cartSlice = createSlice({
  name: "cart",
  initialState: { items: [] },
  reducers: {
    addItem(state, action) {
      // looks mutable, stays immutable via Immer
      state.items.push(action.payload);
    },
    clear(state) {
      state.items = [];
    },
  },
});

export const { addItem, clear } = cartSlice.actions;
export const store = configureStore({ reducer: { cart: cartSlice.reducer } });

configureStore sets up the store with sensible defaults – the DevTools are already connected, common middleware is included. In TypeScript, you additionally create type-safe hooks once (useAppSelector, useAppDispatch) so that state and actions are typed throughout.

RTK’s strength lies in traceability. Every state change is a named action that runs through a reducer – a loggable, reproducible transition. The DevTools show every action in order, allow time travel through the state history and turn “why is this value suddenly here?” into a question you can answer instead of guess. In large teams and with complex flows, that’s worth its weight in gold: the state flow is a convention everyone shares, not a matter of personal style. The price should be named just as honestly: more structure, more files, a central tree that everything runs through. For the small core of a medium-sized application, that is often more apparatus than the core deserves.

Lightweight Stores: Zustand and Jotai#

The second family starts exactly there: minimal API, no forced provider, as little code as possible. Two representatives from the same ecosystem, but they think differently.

Zustand (yes, the library really is called that – a German word for “state” as its name) gives you a create function that returns a hook. From this hook you use a selector to read exactly the slice of state a component needs. The selector is the key: a component that only reads count doesn’t re-render when another field in the store changes. Re-renders stay granular without you having to nest context providers.

import { create } from "zustand";

const useCartStore = create((set) => ({
  items: [],
  addItem: (item) => set((state) => ({ items: [...state.items, item] })),
  clear: () => set({ items: [] }),
}));

// in a component: read only what you need
const count = useCartStore((state) => state.items.length);

Jotai approaches it from the other side. Instead of one store you read slices from, there are many small, atomic units of state – atoms – that you combine freely. An atom holds a value; derived atoms compute from other atoms. A component subscribes to exactly the atoms it reads, and nothing more.

import { atom, useAtom } from "jotai";

const itemsAtom = atom([]);
const countAtom = atom((get) => get(itemsAtom).length);

// in a component
const [count] = useAtom(countAtom);

The strength of both is obvious: very little code, fine-grained updates, a small bundle. You’re productive in minutes, and there are hardly any concepts to learn. The price is the other side of the same coin – less convention, less predefined structure. Redux forces you into a pattern; a lightweight store leaves you every freedom, including the freedom to build yourself a mess. The discipline to keep the store small and orderly, and not to dump server data into it after all, lies with the team. For the small core this is about, that is often exactly the right size.

MobX: the reactive approach#

The third family thinks fundamentally differently. Redux and the lightweight stores are immutable at their core: changing state means producing a new state. MobX turns that around. You describe observable state, mutate it directly, and the library tracks on its own who reads what and updates exactly the places concerned.

You make an object observable with makeAutoObservable. You declare derived values as computed – here as getters – and they update by themselves as soon as their basis changes. Components you wrap in observer react specifically to exactly the observed values they read while rendering.

import { makeAutoObservable } from "mobx";
import { observer } from "mobx-react-lite";

class CartStore {
  items = [];
  constructor() {
    makeAutoObservable(this);
  }
  addItem(item) {
    this.items.push(item); // direct mutation is fine here
  }
  get count() {
    return this.items.length; // derived, recomputes automatically
  }
}

const cart = new CartStore();
const CartBadge = observer(() => <span>{cart.count}</span>);

MobX shines when a lot of state is derived from other state. Where in Redux you would have to write and memoize selectors, in MobX the derived value comes about by itself and is only recomputed when its inputs change. Strikingly little code remains whose only job is to connect values. The price is implicitness: precisely because you don’t dispatch anything explicitly, the question “where does this change come from?” is harder to answer – the update happens in the background, triggered by a mutation somewhere in the code. And it’s a different mental model from the rest of the React ecosystem: targeted mutation instead of immutability. If you come from the Redux world, you have to rethink; if you think in objects, you feel at home immediately.

What to base the choice on#

There’s no ranking that holds for everyone – the choice depends on a few properties of the project. The more people work on the same state, the more a fixed convention can help. For loggable transitions and rewinding the state history, the Redux DevTools are a strong but not exclusive solution. With a lot of derived state, MobX’s reactive model plays to its strengths. Add to that the bundle budget, existing tooling requirements and the team’s familiarity; hard judgments about size should be measured on the concrete build, not taken from a table.

A few rules of thumb follow from this, without being laws. If the core really is small – a logged-in person, a theme, a shopping cart – context with useReducer or a lightweight store such as Zustand is enough, and more would be overkill. If a large team faces complex flows and wants auditable transitions, Redux Toolkit is the obvious choice, because it makes exactly this traceability a convention. If the application lives on a lot of derived state that should update in cascades, MobX is in its element. And if two options fit equally well, the team’s familiarity tips the balance.

The choice is secondary#

No tool is “the best.” These comparisons are conducted with a seriousness the matter doesn’t deserve – as if the project’s success hinged on Redux versus MobX. It doesn’t. The choice of store is secondary to the question of ownership that comes before it. If you use the URL for what belongs in the URL and treat server data as a cache instead of as state, you keep the real client state so small that almost any of the three families is enough – and the decision between them shrinks to a matter of taste.

The mistake the tool debate hides is the more expensive one: building a big global store and filling it with URL state and server data that don’t belong there. No Redux Toolkit and no MobX will save you from the bugs that result. Conversely, with cleanly drawn boundaries and the simplest of the lightweight stores, you get surprisingly far. That’s why the counter-check is at the beginning of this post and not at the end: it decides more than the three-column table after it.

Further reading#

Revised and translated from German with the help of AI.