The CartContainer

The CartContainer reads data from the CartCollection, then it renders a list of presentational components, which display the item information and the numbers of available products (inventory) in a dropdown for each item.

The functionality of the cart is that users can remove added items and update the quantity per item in the cart, using the following two functions:

import {CartCollection} from '../../shared/collections/CartCollection';  class Cart extends React.Component {    constructor(props) {    super(props); this.onRemoveItem = this.onRemoveItem.bind(this);       this.onChangeQuanity = this.onChangeQuanity.bind(this);  }

In the constructor, we bind two event handlers: onRemove, the item from the cart, and onChange, the quantity ...

Get Build Applications with Meteor 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.