Created
January 26, 2018 10:16
-
-
Save sagar-ganatra/8c9c5e96fc97883686c9a007c808a0b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
import { observer } from "mobx-react"; | |
import Book from "../Book/"; | |
import "./ShoppingCart.css"; | |
@observer | |
class ShoppingCart extends Component { | |
render() { | |
return ( | |
<div className="shopping-cart-component"> | |
<header>Shopping Cart (Total Count: {this.props.cart.bagCount})</header> | |
<ul className="cart-list"> | |
{this.props.cart.itemsInBag.map(item => { | |
return ( | |
<li className="cart-item" key={`shopping-cart-${item.book.id}`}> | |
<Book book={item.book} /> | |
<div>Count: {item.count}</div> | |
</li> | |
); | |
})} | |
</ul> | |
</div> | |
); | |
} | |
} | |
export default ShoppingCart; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment