DEV Community

Discussion on: Javascript's import vs require?

Collapse
 
buttercubz profile image
Erick Sosa Garcia

Also if you want to load a module dynamically, you can use the dynamic imports

const module = (await import("some_module")).default;

const { ... } = await import("some_module");
Enter fullscreen mode Exit fullscreen mode
Collapse
 
xtineskim profile image
Christine Kim

ooooh, I'm going to have to try this out! :)

Collapse
 
standelethan profile image
Ethan Standel

That's how you manage lazy loaded routes in React.