Define state:
> state = { aa: 11, bb: 22 }
{ aa: 11, bb: 22 }
First way, create new object with Object.assign:
> Object.assign({}, state, { aa: 99, cc: 33 })
{ aa: 99, bb: 22, cc: 33 }
Second way, use destructuring to create new object with the same properties:
> {...state, aa: 99, cc: 33 }
{ aa: 99, bb: 22, cc: 33 }
Make sure state is the same:
> state
{ aa: 11, bb: 22 }