Skip to main content
InterviewHubPRO
Section Overview
Q195

Question 195 of 407

Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

48%
React Core & Hooks (407 Qs)•Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

What is dynamic import?

junior LevelCode ExampleFormsPerformance

You can achieve code-splitting in your app using dynamic import.

Let's take an example of addition,

  1. Normal Import
javascript
import { add } from "./math";
console.log(add(10, 20));
  1. Dynamic Import
javascript
import("./math").then((math) => {
console.log(math.add(10, 20));
});