useSnapshot and re-renders #279
|
Hey! Thanks again for this great package. I want to clarify one thing. For manual re-render subscriptions, I use the following construction: Now I am using this construction: and everything works fine, but I want to clarify the difference between There is no difference in my understanding, but I'm not sure. |
Replies: 1 comment 1 reply
|
|
useSnapshot(state).a.bmeans subscribing tostateand rendering if.a.bchanges.useSnapshot(state.a).bmeans subscribing tostate.aand rendering if.bchanges.Technically, the latter can be more performant, because it's more granular subscription.
Only the former allows to mutate like
state.a = ....