Let's say I have the following code:
componentDidMount() {
$.ajax({
type: 'GET',
url: '/data/',
dataType: 'text',
success: function(response) {
this.setState({data: response})
}.bind(this)
});
}
render() {
let {rows} = this.state.data
return (
<div>
WOW
{this.state.data}
<FilterTable rows = {this.state.data} />
</div>
);
}
How can I make it so that the render() portion does not execute till ajax call is done?
Thanks!
EDIT: Fixed code.