case SET_WINE_ITEMS:
const { index, name, value } = action.payload
const items = state.items
items[index][name] = value
return { ...state, items }
Is there a succinct way to use spread operators to implement the code above?
case SET_WINE_ITEMS:
const { index, name, value } = action.payload
const items = state.items
items[index][name] = value
return { ...state, items }
Is there a succinct way to use spread operators to implement the code above?
Thank you for your comments. The structure of my array of objects is below, where there can be many objects in the items array.
I found a way to accomplish updating the redux state without mutating it using spread operators: