fixed missing ifmounted bug / fixed getting item when navigating directly to page
This commit is contained in:
@@ -7,17 +7,9 @@ var ItemCollection = require('../../models/itemCollection');
|
||||
var AllItems = React.createClass({
|
||||
|
||||
render: function() {
|
||||
if(this.state) {
|
||||
return (
|
||||
<ItemList items={this.state.items} />
|
||||
);
|
||||
}
|
||||
else {
|
||||
return (
|
||||
<div> Not Loaded ! </div>
|
||||
);
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// Add change listeners to stores
|
||||
@@ -26,6 +18,14 @@ var AllItems = React.createClass({
|
||||
ItemStore.addChangeListener(this._onChange);
|
||||
},
|
||||
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
items: ItemStore.getItems()
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_onChange: function () {
|
||||
if (this.isMounted()) {
|
||||
this.setState({
|
||||
|
||||
Reference in New Issue
Block a user