You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In most cases they are equivalent because React batches the setState calls. Technically Practice 1 is going to be faster, and more memory efficient (probably) because you are mutating the original state object before setting it again. However its also less safe, and not recommended to mutate the state object in-place like that. I wouldn't worry about it unless you are able to measure some noticeable bottleneck there
Suppose if I have 100 objects and each maps to 100 different DOM components. Which of the following coding practice helps react setState() save work:
Practice 1:
OR
Practice 2:
The text was updated successfully, but these errors were encountered: