DEV Community

Discussion on: 3 Mistakes Junior Developers Make with React Function Component State

Collapse
 
thomasburleson profile image
Thomas Burleson

Exactly.
To paraphrase your reply.
1) Immutability means data modifications will result in new instances; so explicit comparisons are supported and deep-comparisons can be avoided.
2) The setter function also implicitly triggers the FC to asynchronously re-render. Without the setter, the data would be updated, but the FC would not redraw to reflect the current data state.