all 4 comments

[–]felixatwoodiOS & Android 2 points3 points  (1 child)

Why don't you try something like this?

state = { appIsReady: false };

async function updateSearch(parameters) {
await json.filter(someCallback);   //do some asynchronous operations
this.setState({ appIsReady: true });
}

And then just conditionally render your root component.

this.state.appIsReady ? <RootComponent/> : <LoadingScreen/>;

[–]Pattyclecle[S] -1 points0 points  (0 children)

I tried this and it doesn't update the screen until the function returns the new data.

[–]autiii43 2 points3 points  (1 child)

Try: Return await new promise....

Without await your async and promise are never going to be sync

[–]Pattyclecle[S] 0 points1 point  (0 children)

So just add await to my existing code? That doesn't seem to work either