redux ditambahkan ke array
case ADD_ITEM :
return {
...state,
arr: [...state.arr, action.newItem]
}
Enthusiastic Earthworm
case ADD_ITEM :
return {
...state,
arr: [...state.arr, action.newItem]
}
case 'increment':
// console.log('increment');
return state.map((item) => {
console.log(item.id,'===',action.payload2);
if (item.id === action.payload2) {
// console.log('true');
const updatedItem = {
...item,
incart:true
};
// console.log('ui',updatedItem);
return updatedItem;
}
// console.log(item);
return item;
});