Component-Level Splitting: When It Helps
What you'll learn: When to split individual components (beyond routes) and when the complexity cost isn't worth it.
The Granular Splitting Question
Route-level splitting is the baseline for most apps—but what about splitting individual components? After all, React.lazy() works anywhere, not just routes. The question is: when does the performance gain justify the added complexity?
When Component Splitting Makes Sense
Split heavy components that are:
-
Conditionally rendered — A rich text editor loaded only when the user clicks "Edit." If 80% of users never edit, why load it?
-
Behind interactions — Modals, tooltips, or charts that appear on-demand. No need to load a 50KB charting library until the user clicks "View Analytics."
-
Large and self-contained — A PDF viewer, video player, or complex form wizard. If the component pulls in substantial dependencies, splitting saves initial load.
-
Low-priority — Features below the fold or in secondary tabs. Load the critical path first, defer the rest.
When It Doesn't Help
Don't split components that:
- Render immediately on page load — You've just added latency for no gain.
- Are small — Splitting a 2KB component adds overhead for minimal benefit.
- Are used everywhere — If every route needs it, splitting creates wasteful extra requests.
Key Takeaway: Component-level splitting shines for large, conditionally-rendered features—especially those behind user interactions. Split strategically where the performance gain outweighs the added network request and Suspense boundary complexity.