← All libraries

Zustand

JavaScript
↗ Official site

App memory & data sync

Simple, lightweight state management for React apps.

What it does

Zustand is like a global variable store for your React app — it holds data that multiple components need to share. Much simpler than Redux.

When to use it

Use this when your React app has state that needs to be shared across many components.

Real example

You have a shopping cart in React and need the cart count to update in both the Navbar and the sidebar without prop-drilling. Prompt: 'Create a Zustand store with a cartItems array and addItem/removeItem actions. Import useCartStore in both Navbar and CartSidebar to read the count and trigger updates.'

Good to know

If you're not using React, you don't need this. For simple apps, React's built-in useState is often enough.

Alternatives

Redux Toolkit Jotai Valtio

Install

$ npm install zustand

Use cases

state managementReactglobal statestore

Language

JavaScript

Category

App memory & data sync

More in App memory & data sync

Other tools in the same category