Course · Section 9: Data Structures, Modern Operators and Strings · Lecture 111: The Spread Operator (...)
State often nests objects, e.g. `{ user: { name, age }, theme }`. Implement `updateUserField(state, field, value)` returning a new state object with `state.user[field]` replaced, without mutating the original.
+ 1 hidden test run on Submit.
Immutable nested updates copy every level on the path to the change. Spreading state copies the top level, spreading state.user copies the nested object, and the computed key [field] overrides just the targeted property.
Run your code to see results.