Code Splitting in React
Code splitting loads JS when needed. React.lazy(() => import('./Chart')) + <Suspense fallback={<p>Loading…</p>}>. Split heavy routes and charts, not a 3-line Button. Default Vite already splits vendor vs app; lazy is extra for large screens.
Error boundary around a lazy route is nice — chunk fail on bad network. Don’t lazy everything or you’ll flicker Loading on every tiny widget.
Code Splitting in React — first paint Loading… then Chart. Don’t lazy-load a 3-line Button.
lazy + Suspense. When it’s worth it.