Zustand · Function
createContext
Current Zustand uses a regular React context with a store made by createStore. Keep the store stable in a ref, then read it with useStore.
Last updated
Syntax
const StoreContext = createContext(null)
const store = createStore((set) => ({ ... }))
useStore(store, selector)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
createStoreuseStorecreateContextuseContextuseRefStoreContext