FlashcardNot attempted
Route-level code splitting
Recall it before you reveal
What does React.lazy(() => import('./pages/Checkout')) do at build time and at run time?
Space to reveal
Show answer & explanation
Build time: every dynamic import() is a split point. The bundler puts that module (and code only it uses) into its own chunk with a hashed name, and code shared by several chunks into shared chunks.
Run time: the chunk is fetched the first time the component renders. Until it arrives the component suspends, and the nearest <Suspense> boundary shows its fallback. Once loaded, the module stays in memory for the life of the page.
Splitting by route is the usual default: users download only the pages they open, so the entry stays small.