Code Splitting Examples

I decided to test code splitting to improve the loading time on webpages with code splitting and this is my test.

I tried in 3 ways:

  • Route based chunking or splitting up the javascript files;
  • Component based chunking or splitting up the javascript files while loading components on demand;
  • The new feature available on React, React.lazy() loads only when we used on the render function*

*This is the best one I choose to go, the other as commented.