0
0 Comments

const onAdd = (product) => {
const exist = cart.find((x) => x.id === product.id);
if (exist) {
setCart(
cart.map((x) =>
x.id === product.id ? { …exist, qty: exist.qty + 1 } : x
)
);
} else {
setCart([…cart, { …product, qty: 1 }]);
}
};

Basir Changed status to publish October 11, 2022