5👍
✅
You have to control your state like below:
var App = React.createClass({
getInitialState: function(){
return {
names: [],
isLoaded: false
}
},
componentDidMount: function() {
$.get(url, function (data) {
this.setState({
names: data,
isLoaded: true
})
}.bind(this));
},
render: function() {
return(
<div>
{this.state.isLoaded ? <Graph names={this.state.names}/> : <div>Still Loading... </div> }
</div>
)
}
});
So once you get all your data you can render your chart otherwise show the loading screen. Take a look at this Link probably it will be helpfull for you. Hope it makes sense for you.
Source:stackexchange.com