var React = require('react');
var ReactPropTypes = React.PropTypes;

var Header = React.createClass({

	propTypes: {
		productsQuanitity: ReactPropTypes.number.isRequired,
	},
    getInitialState: function () {
		return {
			productsQuanitity: this.props.productsQuanitity
		};
	},
    componentWillMount() {
       CartStore.addOnProductWasAddedToCartListner(this.onProductWasAddedToCartListner);
    },
    componentWillUnmount(){
       CartStore.removeOnProductWasAddedToCartListner(this.onProductWasAddedToCartListner);
    },
    onProductWasAddedToCartListner: function (product) {
      this.setState({productsQuanitity:product.quantity});  
    },
    render: function()
    {
        <div>
            <label>Cart ({this.state.productsQuanitity})</label>
        </div>
    }
});

module.exports = Header;
Rerun