The CartItems component

The CartItems component will allow the user to view and update the items currently in their cart. It will also give them the option to start the checkout process if they are signed in:

If the cart contains items, the CartItems component iterates over the items and renders the products in the cart. It there are no items added, the cart view just displays a message that the cart is empty.

mern-marketplace/client/cart/CartItems.js:

{this.state.cartItems.length > 0 ? <span>      {this.state.cartItems.map((item, i) => {          ...                      … Product details              … Edit quantity              … Remove product option          ...        })      } … Show total price and Checkout options ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.