Skip to content
Discussion options

You must be logged in to vote

If replace is falsy and the state is object, set will "shallow merge" the previous object and the new object.

zustand/src/vanilla.ts

Lines 76 to 78 in 6737115

(replace ?? (typeof nextState !== 'object' || nextState === null))
? (nextState as TState)
: Object.assign({}, state, nextState)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fa-901
Comment options

Answer selected by fa-901
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants