React and Redux E-commerce
Hello everyone i have an issue with my ecommerce shop when i add items to the cart from my normal page they are adde, but when i try to increase or decrease their quantity i cant i should press addToCart, down below i will share mycode and liveDemo!
https://github.com/Anes039/Test
Demo:
https://38pnml-5173.csb.app/
1 Reply
i fixed it
the solution was simple
{cart.quantity == 0 ? (
<p>There is no item in cart</p>
) : (
cart.map((item, id) => {
return (
<li className={classes.product_list} key={id}>
<CartItem
key={item.id}
id={item.id}
img={item.img}
team={item.team}
price={item.price}
quantity={item.quantity}
/>
</li>
);
})
)}
at Cart jsx i just had to add id = {item.id} to my CartItem because when i did console.log i got undefined
and then i went just using console and checking for bugs