Files
old-ribica/front-ui/app/components/cart/cartPage.js
2015-02-13 06:52:10 +01:00

48 lines
903 B
JavaScript

var React = require('react'),
CartStore = require('../../stores/cartStore'),
AddToCart = require('../cart/addToCart');
var Router = require('react-router');
var ItemWithDetailsPage = React.createClass({
render: function() {
return (
<div className="cart-page row-fluid center">
This is the cart page!
</div>
);
},
// Add change listeners to stores
componentDidMount: function() {
CartStore.addChangeListener(this._onChange);
},
componentWillUnmount: function () {
CartStore.removeChangeListener(this._onChange);
},
_onChange: function () {
if (this.isMounted()) {
this.setState(ItemDetailsStore.getState());
}
},
getInitialState: function () {
return CartStore.getState();
}
});
module.exports = ItemWithDetailsPage;