← React Intermediate Questions - Set 2 Q15
What is code splitting and how can you implement it in React?
React Intermediate Questions - Set 2
Example
1
2
const Reports = lazy(() => import('./Reports'));
<Suspense fallback={<Spinner />}><Reports /></Suspense>;
What to notice
- Route-level splitting gives the biggest win; Vite/webpack emit a chunk per `import()`.
← Back to the question list