Zustand · Concept
Immutable state and merging
Zustand updates state immutably. set merges returned values at the top level, while nested objects need an explicit copy and merge.
Last updated
Syntax
set((state) => ({ field: nextValue }), replace?)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
Updating statePractice with no store actionsMaps and sets usageHow to reset state