React - Display loading screen while DOM is rendering?

前端 未结 19 1678
我在风中等你
我在风中等你 2020-11-28 00:29

This is an example from Google Adsense application page. The loading screen displayed before the main page showed after.

I don\'t know how to do the same th

19条回答
  •  迷失自我
    2020-11-28 00:57

    This could be done by placing the loading icon in your html file (index.html for ex), so that users see the icon immediately after the html file has been loaded.

    When your app finishes loading, you could simply remove that loading icon in a lifecycle hook, I usually do that in componentDidMount.

提交回复
热议问题