Component-Level Splitting Decisions
What you'll learn: How to decide which individual components should be split into separate bundles based on size, usage patterns, and user experience impact.
While route-based splitting breaks your app into page-level chunks, component-level splitting targets specific components within those pages. The key is identifying components that carry significant weight but aren't needed immediately.
When to Split Individual Components
Heavy Library Dependencies
If a component imports a large third-party library (like a rich text editor, charting library, or PDF viewer), split it. These libraries often exceed 100KB+ and shouldn't block your initial render. Think of it like ordering dessert separately — you don't need it on the table when appetizers arrive.
const RichTextEditor = lazy(() => import('./RichTextEditor'));
// Only loads draft-js/quill when editing starts
Conditional Features
Components that appear behind user actions (modals, admin panels, settings dialogs) are prime candidates. Most users never click "Advanced Settings," so why load that code for everyone?
const AdminPanel = lazy(() => import('./AdminPanel'));
// Only loaded if user.isAdmin === true
Below-the-Fold Content
Content that requires scrolling to see (charts in dashboards, comment sections, related products) can be split. Users see the hero content first while the rest loads in the background.
const CommentSection = lazy(() => import('./CommentSection'));
// Deferred until user scrolls or page is idle
The Balance
Not every component should be split. Small components (< 20KB), frequently-used features, and anything needed for First Contentful Paint should stay in the main bundle. Profiling shows you the actual bundle sizes and load impact.
Key Takeaway: Split components that are large, conditionally shown, or below-the-fold—but keep critical, lightweight components bundled together to avoid excessive request overhead.