Lesson 32 of 80
Passing a prop through three components that don't use it isn't automatically a problem — this lesson is the judgment call for when it actually is.
12 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
This topic is about judgment and practical tradeoffs more than a single right answer — a mock interview is the better way to test yourself on it.
Be interviewed on this →Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
Prop drilling is passing a value down through components that don't use it themselves, purely so a component further down can. It has a bad reputation, but drilling itself isn't a bug — it's just what one-way data flow looks like when the consumer is a few levels deep. The real skill is telling the difference between drilling that's fine and drilling that's actually costing you something.
function Page({ user }) {
return <Header user={user} />;
}
function Header({ user }) {
return <Nav user={user} />;
}
function Nav({ user }) {
return <Avatar user={user} />; // finally used, three layers down
}
Three components pass user along without touching it. That's mildly annoying to read, but it's also completely explicit — anyone tracing where user comes from can follow the props, one arrow at a time, and never has to guess. That traceability is a real feature, not just something drilling happens to have.
Now widen the tree: user needs to reach a dozen components scattered six and seven levels deep, in unrelated branches — a theme toggle in a footer, a permissions check in a modal, an avatar in three different places. Adding or renaming that prop now means touching every intermediate component on every path, and most of those components have nothing to do with user at all; they're just corridors. That's the version worth fixing, and the fix is Context — covered in the Context lesson, which goes into how a Provider makes a value directly readable by any descendant, and what that costs in re-renders.
children, instead of drilling the raw data down and letting each layer build its own JSX — often removes the drilling entirely without introducing Context's re-render behavior at all.Prop drilling is the plain default of one-way data flow — a value moving down through props, one component at a time. Context is a targeted escape hatch for exactly one shape of pain drilling causes: many distant descendants needing the same value. This lesson is about recognizing when you're actually in that shape versus just passing a prop down a short, explicit path; the Context lesson is about what you get, and give up, once you decide you are.