React – Display loading screen while DOM is rendering?

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

enter image description here

I don’t know how to do the same thing with React because if I make loading screen rendered by React component, it doesn’t display while page is loading because it has to wait for DOM rendered before.

Updated:

I made an example of my approach by putting screen loader in index.html and remove it in React componentDidMount() lifecycle method.

Example and react-loading-screen.

24 Answers
24

Leave a Comment