The Waterfall Problem in Data Fetching
You'll learn how client components create a cascade of slow, sequential network requests that delay your app's interactivity.
The Sequential Dependency Chain
When everything runs on the client, your app suffers from a fundamental performance bottleneck called the "waterfall problem." Here's what happens:
- First: The browser downloads HTML (tiny, fast)
- Then: The browser downloads JavaScript bundles (large, slow)
- Finally: JavaScript executes and fetches data from your API (network round-trip)
Each step must complete before the next can begin. The user stares at loading spinners while these requests happen one after another.
The Waterfall Analogy
Imagine ordering food at three separate restaurants in different neighborhoods. You must:
- Drive to restaurant #1, order, wait, receive food
- Drive to restaurant #2, order, wait, receive food
- Drive to restaurant #3, order, wait, receive food
You can't order from restaurant #2 until you've finished with #1. That's a waterfall—sequential dependencies where each step blocks the next.
Why Client Components Force This Pattern
Client components require JavaScript to run first. They can't fetch data until:
- The HTML loads
- The JS bundle downloads and parses
- React hydrates the component tree
- Your
useEffector data-fetching logic executes
By this point, precious seconds have elapsed. The data was available on the server all along, but your architecture forced the browser to download code before it could even ask for that data.
Key Takeaway: Client-side data fetching creates HTML → JS → Data waterfalls where each network request waits for the previous one to complete, multiplying your app's time-to-interactive.