📅  最后修改于: 2022-03-11 15:04:15.553000             🧑  作者: Mango
代码示例6
if (isItemInCart) {
return prev.map(item =>
item.id === clickedItem.id
? { ...item, amount: item.amount + 1 }
: item
);
}