Quantcast
Channel: Why does async work in ComponentDidMount lead to visual lag when navigating unless a simple timeOut is awaited? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Vencovsky for Why does async work in ComponentDidMount lead to visual lag when navigating unless a simple timeOut is awaited?

$
0
0

Why does the navigation between screens visually lag when doing async...

Maybe it can be laggy because you are on dev mode. Please try it on production.

Why does this visual delay disappear entirely when I await a brief timeout before doing the real async work?

I'm not sure what is NetworkRequest.getData doing, I can be something about it, but if it returns a promise, maybe you should try using await on it.

You are also forgetting to add async to your componentDidMount.

async componentDidMount(){
  await NetworkRequest.getData(payload);
}

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>