Skip to content

Migration playbook: Redux / Redux Thunk → Zustand and TanStack Query

Redux to Zustand and TanStack Query migration

Separate server state (TanStack Query) from client UI state (Zustand), and delete the actions, reducers and thunks that only existed to move data around.

Migration drivers

Why teams make this move

Driver 01

Redux boilerplate

Types, actions, reducers and selectors spread across several files just to fetch and show a list.

Driver 02

Server cache mixed with client state

Loading states, errors and cache invalidation handled by hand inside reducers.

Driver 03

Unnecessary re-renders

Poorly memoized selectors re-rendering large parts of the page on small state changes.

Execution sequence

How the migration runs

Each phase ends with a check you can verify — data parity, error rates, latency — and the rollback path is agreed before any traffic moves.

  1. 01Phase

    Server state to TanStack Query

    Replacing async thunks with useQuery and useMutation hooks that cache automatically.

  2. 02Phase

    Client state to Zustand

    Moving modal toggles, theme preferences and form wizard state into small Zustand stores.

  3. 03Phase

    Incremental Redux removal

    Deleting Redux slices feature by feature, with component tests as the safety net.

  4. 04Phase

    Bundle cleanup

    Removing redux, react-redux and redux-thunk once nothing depends on them.

Risk prevention

Pitfalls that derail this migration

Risk 01

Recreating Redux in Zustand

Writing action dispatchers in Zustand instead of simple state setters.

Risk 02

Unstable query keys

Object references in TanStack Query keys that change every render and trigger refetch loops.

Risk 03

Optimistic update rollbacks

Not saving the previous query data before an optimistic update, so failures can't roll back.

Before and after

What we measure

We take a baseline before any change and report the same numbers after cutover, from your own tools. They are the evidence of whether the migration worked — not figures promised in advance.

State code
Lines of state-management code, before and after
Re-renders
Renders per interaction on key screens (React Profiler)
Bundle size
Client JavaScript after removing the Redux packages

Questions

Frequently asked migration questions

Server state is asynchronous and shared; client state is synchronous and local. TanStack Query handles caching, deduplication and refetching of server state, which removes most of the code reducers were doing.

Yes. Zustand stores and Redux can run side by side in the same app, so components move one at a time.

Rehearse the cutover before the real one

Tell us about your data volume, traffic and timeline. An engineer will reply within one business day to set up a call about the migration plan and its rollback path.