My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

What's the best way to load JavaScript code for specific pages on demand in React?

Aron's photo
Aron
·Apr 25, 2016

I am building a Single Page App with React and I don't want to create a huge bundle and load it. Instead I would like to break it into smaller chunks and load them on specific routes on demand. What's the best way to do it in React or JavaScript in general?