Course · Section 9: Data Structures, Modern Operators and Strings · Lecture 111: The Spread Operator (...)
Implement `setField(state, key, value)` returning a new object with `key` set to `value`.
+ 1 hidden test run on Submit.
Returning { ...state, [key]: value } creates a new object with one field changed, giving React a new reference to detect the update.
Run your code to see results.