DiamondDigger / react-basics

researching react
0 stars 0 forks source link

Add lazy loading with React.Suspense #14

Open DiamondDigger opened 4 years ago

DiamondDigger commented 4 years ago

ReactDom is rendering two times because of useEffect( timer of it) - when ReactDom is mounting and ready to render - it's time for useEffect to take part in action - at that moment our timer for lazy loading is over and we can see our lazy loaded component, after that we can see rendering of our fetch array and it means that state have been changed and ReactDom re-render the whole component again and that is the key moment- cause we need to lazy load our component again