Next.jsQuestion 10 of 15
What is code splitting, and how is it different from lazy loading?
Answer out loud or in your head first, then compare.
Answer
Code splitting breaks JavaScript into smaller bundles. Lazy loading defers loading a part until it's needed.
Example: a heavy editor doesn't need to weigh down the initial view when most people never open it.
To be precise: Next.js splits code for you, and dynamic imports give you extra control over loading components and libraries.
Pitfall: splitting code alone doesn't prove better performance. I check whether less JS is downloaded and run up front, and that the user doesn't then wait too long for the part they need.
How did it go? Be honest — “Not yet” puts the question on your review list.