Zustand v5 is out — the lightweight React state management library continues its philosophy of doing as little as possible, while polishing the TypeScript experience and trimming the bundle further.
By dropping IE11 / legacy CJS patterns, Zustand v5's core is under 1 KB gzipped. For comparison, Redux Toolkit sits at ~12 KB. In a Zustand app, the state logic lives in your own code — the library itself adds almost nothing.
// v4 — needed explicit generic
const useStore = create<{ count: number; inc: () => void }>()((set) => ({
count: 0,
inc: () => set((s) => ({ count: s.count + 1 })),
}));
// v5 — type is inferred automatically
const useStore = create((set) => ({
count: 0,
inc: () => set((s) => ({ count: s.count + 1 })),
}));
Several deprecated patterns from v3/v4 have been removed: the default export, the subscribeWithSelector middleware default arguments, and the combine middleware's mutative API.
npm install zustand@5
npx zustand-migrate # optional codemod for common patterns
All Comments