GitHub
github.com › pmndrs › zustand
GitHub - pmndrs/zustand: 🐻 Bear necessities for state management in React
It may be the one state-manager in the React space that gets all of these right. You can try a live demo and read the docs. ... ⚠️ This readme is written for JavaScript users. If you are a TypeScript user, be sure to check out our TypeScript Usage section. Your store is a hook! You can put anything in it: primitives, objects, functions. State has to be updated immutably and the set function merges state to help it. import { create } from 'zustand' const useBearStore = create((set) => ({ bears: 0, increasePopulation: () => set((state) => ({ bears: state.bears + 1 })), removeAllBears: () => set({ bears: 0 }), }))
Starred by 57.9K users
Forked by 2K users
Languages TypeScript 97.9% | JavaScript 2.1%
Videos
02:29:51
Zustand with Next js and typescript: Build Shopping Cart project ...
01:04:35
React State Management with Zustand & TypeScript - YouTube
05:00
5 Zustand BEST Practices in 5 Minutes - YouTube
React Zustand Tutorial - 1. basic usage (typescript) - YouTube
How to use Zustand in Next js , Typescript & React Project
YouTube
youtube.com › watch
How to Setup Zustand (State Management) with React and TypeScript - YouTube
In this Zustand tutorial, I show step by step how to create a react app with Zustand and Typescript!Code from tutorial: https://github.com/AndyUGA/zustand_re...
Published September 24, 2024
Zustand
zustand-demo.pmnd.rs
Zustand
🐻 Bear necessities for state management in React
npm
npmjs.com › package › zustand
zustand - npm
March 16, 2026 - It may be the one state-manager in the React space that gets all of these right. You can try a live demo and read the docs. ... ⚠️ This readme is written for JavaScript users. If you are a TypeScript user, be sure to check out our TypeScript Usage section. Your store is a hook! You can put anything in it: primitives, objects, functions. State has to be updated immutably and the set function merges state to help it. import { create } from 'zustand' const useBearStore = create((set) => ({ bears: 0, increasePopulation: () => set((state) => ({ bears: state.bears + 1 })), removeAllBears: () => set({ bears: 0 }), }))
» npm install zustand
Published May 05, 2026
Version 5.0.13
Zustand
zustand.docs.pmnd.rs
Zustand: Introduction
Index of documentation for pmndrs/* libraries
YouTube
youtube.com › watch
Manejo de estados en React con Zustand y Typescript - YouTube
👉 Conoce nuestras vacantes actuales de tecnología en https://bit.ly/talento-tech-GDIEn este vídeo te explicamos cómo realizar el manejo de estados en React ...
Published February 6, 2024
Js
react-tracked.js.org › person name (zustand)
Tutorial with zustand - Person Name | React Tracked
This tutorial shows tiny example code with zustand. There are two variants. The first one is with useStore. The second one is with useTrackedStore. JavaScript · TypeScript · import * as React from 'react'; import { useState } from 'react'; import create from 'zustand'; const useStore = create((set) => ({ firstName: 'React', lastName: 'Tracked', setFirstName: (firstName) => set({ firstName }), setLastName: (lastName) => set({ lastName }), })); const EditPerson = () => { const firstName = useStore((state) => state.firstName); const lastName = useStore((state) => state.lastName); const setFirst
Top answer 1 of 6
65
When using zustand with TypeScript, you should use the curried version of create<T>(...) as stated in the first paragraph of the docs.
Replacing
export const useCart = create<CartState>(
by
export const useCart = create<CartState>()(
should solve the problem.
2 of 6
9
Edit: PhilJay's answer is the best answer. This answer is outdated even though marked as the best.
I had the same issue. What I did was:
import create, { GetState, SetState } from 'zustand';
import { devtools, persist, StoreApiWithPersist } from 'zustand/middleware';
const useAssetStore = create<AssetStoreType, SetState<AssetStoreType>, GetState<AssetStoreType>, StoreApiWithPersist<AssetStoreType>>(
persist(
devtools((set) => ({
logo: '',
})),
{ name: 'assetStore', version: 1, getStorage: () => localStorage }
));
So, in your case, you need to explicitly add:
create<CartState, SetState<CartState>, GetState<CartState>, StoreApiWithPersist<CartState>>
CodeSandbox
codesandbox.io › s › bxeuv
zustand-typescript-example - CodeSandbox
October 28, 2021 - zustand-typescript-example by nola.verly using @types/react-router-dom, react, react-bootstrap, react-dom, react-router-dom, react-scripts, zustand
GitHub
github.com › jkapa7 › zustand-typescript
GitHub - jkapa7/zustand-typescript: Zustand integration with React and Typescrit, using Zustand methods get, set and implementing "actions" in it with fetchings
Zustand integration with React and Typescrit, using Zustand methods get, set and implementing "actions" in it with fetchings - jkapa7/zustand-typescript
Author jkapa7
Medium
medium.com › @rahulguptaxyz15 › set-up-zustand-in-react-typescript-e73cc5ae01be
Set up Zustand in React (Typescript) | by rahul gupta | Medium
September 24, 2025 - // src/pages/bear/BearSlice.ts import type { StateCreator } from "zustand"; import type { IStore } from "../../store/store"; export interface BearSlice { bear: { count: number; increase: () => void; decrease: () => void; }; } export const createBearSlice: StateCreator< IStore, [["zustand/devtools", never]], [], BearSlice > = (set, _get, _api) => ({ bear: { count: 0, increase: () => set((state: IStore) => ({ bear: { ...state.bear, count: state.bear.count + 1, }, })), decrease: () => set((state) => ({ bear: { ...state.bear, count: state.bear.count - 1, }, })), }, });