Using setIn() to change a temp state variable

Hey there @MarkR

The first parameter can be as long as you want, and it does not have a defined structure. The structure depends on the structure of your temporary state. See my example below of updating a nested value in an object:

Screen Recording 2021-06-30 at 5.49.27 PM

As you can see, the path array is the name of keys which directs to the correct one to update. (in this case I wanted to update the value of key2 which is nested under the key named "a" and then under a key named "key"

6 Likes