React - Display loading screen while DOM is rendering?

前端 未结 19 1676
我在风中等你
我在风中等你 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:46

    If anyone looking for a drop-in, zero-config and zero-dependencies library for the above use-case, try pace.js (http://github.hubspot.com/pace/docs/welcome/).

    It automatically hooks to events (ajax, readyState, history pushstate, js event loop etc) and show a customizable loader.

    Worked well with our react/relay projects (handles navigation changes using react-router, relay requests) (Not affliated; had used pace.js for our projects and it worked great)

提交回复
热议问题