When Prop Drilling is Actually Fine
You'll learn: Not all prop drilling is bad—sometimes it's the clearest, simplest solution.
The Two-to-Three Level Rule
Context feels like magic, but explicit props can be more readable when your component hierarchy is shallow. If you're passing props through only 2-3 levels, prop drilling is often perfectly fine.
Think of it like handing a package to your neighbor versus setting up a neighborhood mailbox system. For one delivery to someone next door, just hand it to them directly. You don't need infrastructure.
When Explicit is Better
Shallow hierarchies benefit from explicitness:
- Traceability: You can see exactly where data flows by reading three components
- No magic: No hidden subscriptions or re-render surprises
- Easier debugging: Props show up clearly in React DevTools
- Simpler onboarding: New developers understand props first
App
└── UserProfile (receives user)
└── ProfileHeader (receives user)
└── Avatar (uses user.avatarUrl)
In this 3-level chain, passing user through each layer is clearer than introducing Context. Anyone can trace the flow in seconds.
The Clarity Test
Ask yourself:
- Can I see the entire prop path on one screen?
- Are all intermediate components logically related to this data?
- Would Context obscure where the data comes from?
If yes, keep the props. Context shines when you have 5+ levels, unrelated intermediate components, or truly global state like themes.
Key Takeaway: Prop drilling through 2-3 shallow levels is often clearer and simpler than introducing Context—embrace explicitness when the hierarchy is short and traceable.