I have a case in redux reducers and I used an object.assign to take a copy of my state, and I want to transform it to new syntax spread operator"...state", how can I make it,
Without making a mutation!
case INCREASE_QUANTITY: {
return Object.assign({}, state, {
cart: state.cart.map(item => {
if (item.product.id === action.productInfo.product.id) {
return Object.assign({}, item, {
quantity: action.quantity + 1,
});
}
return item;
}),
});
}