Is the state below mutated by the second line?
let state = { a: 1, b: 2, c: 3 };
state = { ...state, c: 4 };
It should be making a copy of the state as the following shows and so it should not be mutating e.g.
let state = { a: 1, b: 2, c: 3 };
let old = state;
state = { ...state, c: 4 };
let newState = state;
console.log(old);
console.log(newState);
With the following output for each console logs
{a: 1, b: 2, c: 3}
{a: 1, b: 2, c: 4}
Is this ok to be used in the context of React setState?