I'm using React js and the Biff Flux implementation. I have a question on the best way of achieving load from server.
getInitialState: function(){
return{
loading: true
};
},
componentDidMount: function(){
MyAction.fetchsomeData();
},
storeDidChange: function(){
var data = MyStore.getsomeData();
// set state
this.setState({loading: false});
},
render: function(){
// wait for render until response from server
// really?
if( this.state.loading ){
return null;
}
// do render
}
Is this the correct way of doing it? Sometimes I have a Controller that loads the data and sends it as props to it's child components but still I don't know the best way of render the component when I must wait for a response from the server.