InterviewHubPRO
Section Overview
Q323

Question 323 of 521

Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

62%
JavaScript Internals (521 Qs)•Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

What are dynamic imports

The dynamic imports using import() function syntax allows us to load modules on demand by using promises or the async/await syntax. Currently this feature is in stage4 proposal. The main advantage of dynamic imports is reduction of our bundle's sizes, the size/payload response of our requests and overall improvements in the user experience. The syntax of dynamic imports would be as below,

javascript
  import("./Module").then((Module) => Module.method());