← BYTES
React.js·Starter·Ref: 4.1.20
What does it generally mean when people say React state updates are "immutable"?
Have a question about this video? Mention reference 4.1.20 when you contact us.
a.You should produce a new value (e.g. a new array or object) rather than mutating the existing state value in place, then pass that new value to the setter
b.You should modify arrays/objects in state directly, then call the setter to confirm
c.State in React can never be changed once a component mounts
d.Immutability only applies to class components, not function components
React detects whether state actually changed largely by reference comparison. If you mutate an existing object/array in place and pass the same reference back to the setter, React may not detect a change at all -- so the convention is to build and pass a brand-new value instead.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES4120#Reactjs