Redux & Redux Toolkit Course
Redux & Redux Toolkit
/
Intermediate

Redux vs Zustand

Definition

A comparison between the enterprise-heavy Redux architecture and Zustand, a lightweight, minimalist state management library that has gained massive popularity.

Explain Like I'm New

Redux requires wrapping your app in a Provider, writing slices, and strict architectural rules. Zustand is just a simple hook. You say `create((set) => ({ bears: 0, increase: () => set({ bears: bears + 1 }) }))`, and you're done. No boilerplate.

Real World Example

Using Zustand for a small to medium-sized dashboard because Redux feels like using a sledgehammer to crack a nut.

Common Use Cases

  • Choosing a state management library for a new project

Interactive Example

// 🐻 ZUSTAND (Look how simple it is!)
import { create } from 'zustand'

// 1. Create the store and actions in one block
const useStore = create((set) => ({
  count: 0,
  increment: () => set((state) => ({ count: state.count + 1 })),
}))

// 2. Use it anywhere. No Provider needed!
function Counter() {
  const count = useStore((state) => state.count)
  const increment = useStore((state) => state.increment)
  return <button onClick={increment}>{count}</button>
}

Interview Questions

basic

  • Does Zustand require you to wrap your app in a `<Provider>` component?

intermediate

  • If Zustand is so much easier, why do massive enterprise companies still choose Redux?

Flash Cards

Question

Require Provider?

Click to reveal answer
Answer

No. Zustand uses hooks that can be imported and used anywhere instantly.

Question

Why Redux?

Click to reveal answer
Answer

Redux forces strict architectural patterns. On a team of 50 developers, strict rules prevent chaos. Redux also has RTK Query (unmatched for data fetching), the best DevTools in the industry, and a massive ecosystem of middleware.