Trying To Render A "loading" Prompt But Then The Data Once Its Ready
I have MyFunction() that populates a data source for my render's listView, and the process works on a local database and starts in the constructor of the screen. Constructor: cons
Solution 1:
At first, you don't need Data in state, as you don't use it at all.
To solve your problem you can use such constructor:
constructor(props) {
super(props);
getDataFromServer().then((response) => {
letDataSource = newListView.DataSource({
rowHasChanged: (r1, r2) => r1 !== r2
});
this.setState({
IsLoading: false,
DataSource: DataSource.cloneWithRows(response)
});
});
this.state = {
IsLoading: true
};
}
Post a Comment for "Trying To Render A "loading" Prompt But Then The Data Once Its Ready"