Skip to content
Back to Pathway
patternsintermediate

Prop Drilling

The anti-pattern of passing props through multiple levels of intermediate components that do not need the data.

Mental Model

"The Bucket Brigade: 10 people in a line passing a bucket of water to extinguish a fire at the end of the street."

Interactive Engine Walkthrough

Walkthrough Idle
Click "Animate Update" to play the state reconciliation walkthrough.

Reference Code Snippet

Component.jsx
JSX / React 19
1function App({ user }) {
2  return <Layout user={user} />;
3}
4
5function Layout({ user }) {
6  return <Header user={user} />;
7}
8
9function Header({ user }) {
10  // Header doesn't even use 'user', 
11  // it just passes it to Nav!
12  return <Nav user={user} />;
13}
Technical Takeaways & Best Practices
  • 01.Prop drilling creates tight coupling between intermediate layout components and deep child data.
  • 02.Component composition (passing JSX via children) is often cleaner than introducing global Context.
  • 03.Use Context API when data is truly global across widely separated branches (e.g. current user, theme, locale).

01. The Middleman Problem

Prop drilling happens when you pass data through several layers of components that don't actually need it, just to get it to a deep descendant. This creates tight coupling and makes it difficult to move or refactor intermediate components.

Coupling Chain

A (Source)
prop →
B (Middleman)
prop →
C (Target)

02. The Solutions

There are two primary ways to stop prop drilling: **Component Composition** (passing the child itself instead of data) and **Context API**. Composition is often better because it keeps your components more flexible and reusable without global state.

Architectural Advice

"Don't reach for Context too early. First, see if you can pass the component as a child or a prop. Composition is the 'Clean Code' way to solve drilling while keeping your dependencies local and obvious."