npmbot.com
AI

zustand

v5.0.3MITTree-shakeableTS Ready

A small, fast and scalable bearbones state-management solution using simplified flux principles.

99/ 100
Excellent Health
Weekly Downloads
6.8M
Bundle Size (gzip)
1.2 kB(3.2 kB min)
Dependencies
Zero Deps
Last Updated
2025-01-20
SPONSORED CLOUD & DEV TOOLSβ€’Google Ads Partner
NPMBot AI Assessment

The uncontested favorite for React state management in the modern era.

Zustand eliminates the boilerplate of Redux without losing predictability. It works without React Context providers, avoids unnecessary re-renders via selector subscriptions, and weighs only 1.2kB gzipped. It can even be read and updated outside of React components.

Key Advantages
  • β€’Zero boilerplate: no providers, no reducers, no actions ceremony
  • β€’Works outside React components (in vanilla JS, fetch interceptors, WebSockets)
  • β€’Micro-sized footprint (~1.2 kB gzipped) with zero dependencies
  • β€’Clean middleware support (persist, devtools, immer)
Gotchas & Limitations
  • β€’Uncontrolled store structure can become chaotic on large teams without convention
Recommended For:

95% of modern React and Next.js applications, Teams escaping Redux boilerplate

Avoid If:

Complex distributed state machines where XState is appropriate

FEATURED PARTNERβ€’Google Ads Partner
Installation & Quickstart
Package Manager Command
javascript
npm install zustand
zustand Usage Example
javascript
import { create } from 'zustand';

const useStore = create((set) => ({
  bears: 0,
  increasePopulation: () => set((state) => ({ bears: state.bears + 1 })),
  removeAllBears: () => set({ bears: 0 }),
}));
Compare zustand with Alternatives