get the loading status of the component tree
get the loading status of the component tree
var LoadingStatusMixin = require('react-loading-status-mixin');
React.createClass({
mixins: [LoadingStatusMixin],
componentWillMount: function() {
var self = this;
request.get('/api', function(res) {
self.setState({data: res});
// tell the mixin the component has loaded its data
self.setIsLoaded(true);
});
},
render: function() {
// compute the className based on the loaded status
var className = this.isLoaded() ? 'loaded' : 'loading';
return (
React.DOM.div({className: className})
);
}
});
Set the loaded status for the component
Get the loaded status for the component, including all of the children