var Inventory = React.createClass({ propTypes: { cards: React.PropTypes.array }, getInitialState: function() { return { cards: [] }; }, componentDidMount: function() { $.get(this.props.source, function(result) { if (this.isMounted()) { this.setState({ cards: result }); } }.bind(this)); }, render: function() { return (
Cards:
); } }); $(document).on("page:change", function() { if (document.getElementById("inventory") != null) { React.render( , document.getElementById('inventory') ); } })