-
|
Example: I know I can update the state like this: But what if I have a big object, can I do like this: Or should I create a new proxy? How is this going to affect react re-renders? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
state.a = {
b: 2,
c: 3,
}That's just fine. If you want a partial update, this works too. Object.assign(state.a, {
b: 2,
c: 3,
}) |
Beta Was this translation helpful? Give feedback.
-
It's the same thing.
It depends on how you use |
Beta Was this translation helpful? Give feedback.
It's the same thing.
It depends on how you use
useSnapshot, but it's generally render optimized even if you replace the big object.