From e2dfadc739eb81f8d7ab797efa6e9282e8743b9e Mon Sep 17 00:00:00 2001 From: oscar Date: Sat, 18 Mar 2023 22:50:22 +1300 Subject: [PATCH] complete the cart add item hander --- src/components/Cart/Cart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Cart/Cart.js b/src/components/Cart/Cart.js index d73bc85..93b38c9 100644 --- a/src/components/Cart/Cart.js +++ b/src/components/Cart/Cart.js @@ -12,7 +12,7 @@ const Cart = (props) => { const hasItems = cartCtx.items.length > 0; const cartItemAddHandler = (item) => { - cartCtx.addItem(item); + cartCtx.addItem({ ...item, amount: 1 }); }; const cartItemRemoveHandler = (id) => {