#interestingProblem can anybody explain, please I had a problem while updating the state as in the first code block, but there was no problem when I updated the state as in the second code block as below.
I had a problem: (cannot assign to read-only property of object quantity)
const newItem = action.payload
newItem.quantity = 1
state.items = [...state.items, newItem]
I had no problem when I wrote the code like this
const newItem = action.payload
state.items = [...state.items, { ...newItem, quantity: 1 }]