VP
Size: a a a
VP
J
VK
J
let index = state.shopItems.findIndex(e=>e.id === action.payload.id)
if (index>-1) {
state.shopItems[index].count++
} else state.shopItems.push(action.payload)
я еле допер че там за форич внутриVK
J
VK
VP
VK
J
let index = state.shopItems.findIndex(e=>e.id === action.payload.id)
let elem = state.shopItem[index];
if (elem.count>1) {
count—
} else {
state.shopItems. (filter или splice)
}
VP
const shopItem = state.shopItems.find(item => item.id === action.payload.id)
IS
J
A
J
XX
S
VK
VP