Next.js · Junior · Question 39 of 75

How do you lazy-load a heavy client component in Next.js?

Explanation

const Chart = dynamic(() => import('./Chart')) moves the code into a separate chunk and lets you specify loading. The ssr: false option disables server rendering but can be used only in client components. Server components don't end up in the bundle anyway.

Further reading

Problem with a question

Next.js · Junior · question 39

Test yourself

Take the Next.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz