<ListGroup>
{cartItems.map((item) => (
<ListGroup.Item key={item._id}> // <= this is uniqe key isnt it?
{/* Warning: Each child in a list should have a unique “key” prop. Check the render method of `CartScreen` === error . so.. it SHOWS ONLY LAST ITEM FROM CART LIST NOT ALL OF THEM WHEN YOU BUY DIFFERENT ITEMS. So i have no idea how to fix this. i guess code is ok, HELP NEEDED. CANT FIGURE IT OUT ON MY OWN. screenshot from CartScreen.js */}
<Row className=”align-items-center”>
<Col md={4}>
<img
src={item.image}
alt={item.name}
className=”img-fluid rounded img-thumbnail”
></img>{‘ ‘}
<Link to={`/product/${item.slug}`}>{item.name}</Link>
</Col>
<Col md={3}>
<Button variant=”light” disabled={item.quantity === 1}>
<i className=”fas fa-minus-circle”></i>
</Button>{‘ ‘}
<span>{item.quantity}</span>{‘ ‘}
<Button variant=”light” disabled={item.quantity === item.countInStock}>
<i className=”fas fa-plus-circle”></i>
</Button>
</Col>
<Col md={3}>${item.price}</Col>
<Col md={2}>
<Button variant=”light” >
<i className=”fas fa-trash”></i>
</Button>
</Col>
</Row>
</ListGroup.Item>
))}
</ListGroup>
hello there,
you have 2 product with same id in the cart items. based on this condition:
https://github.com/basir/mern-amazona/blob/master/frontend/src/Store.js#L33
we don’t let having 2 products with same _id in the cart. compare you code with this to fix the issue.


Same issue. How do I fix? Code is the same as yours.

Please ask any coding questions here:
https://codingwithbasir.com/questions/ask/

Please ask this question here:
https://codingwithbasir.com/questions/ask/
I answer it on daily basis.
I have the same code as you, yet I’m stilling getting the same error. The error says it’s something in the CartScreen