Full answer
Imagine an App that has a user, a Page that holds a Header, and the Header contains an Avatar that shows the user's name. If App passes user to Page, which passes it to Header, which passes it to Avatar, then Page and Header carry a prop they never use. That is prop drilling.
Two or three layers of drilling is normal and often the clearest choice. It becomes a problem when the chain is long, or when renaming the prop means editing many files.
There are three common fixes, in the order most teams try them.
Composition. Instead of passing data down, build the element where the data lives and pass the finished element down. In the example, App creates <Avatar user={user} /> and hands it to Page as a prop called avatar. Page and Header only place it. This removes drilling without any new API and keeps components easy to test. Passing children works in the same way.
Context. When many components at different depths need the same value, such as the current user, language or theme, put it in a context. Any descendant reads it with useContext. Context suits values that change rarely, because every consumer re-renders on a change.
A state library. Redux Toolkit, Zustand or Jotai give shared, fast-changing state with selectors, so components subscribe only to the pieces they need. This is useful in larger apps, not a first reaction to drilling.
Try composition first. Many apps reach for context too early, and then every component quietly depends on a global.
function Avatar({ user }) {
return <strong>{user.name}</strong>;
}
function Header({ avatar }) {
return <header>Welcome back: {avatar}</header>;
}
function Page({ avatar }) {
return (
<main>
<Header avatar={avatar} />
<p>Your dashboard</p>
</main>
);
}
export default function App() {
const user = { name: 'Asha' };
return <Page avatar={<Avatar user={user} />} />;
}Page and Header never see the user object. They receive a finished element and only decide where it goes. Rendered result: <main><header>Welcome back: <strong>Asha</strong></header><p>Your dashboard</p></main>
Key points
- Prop drilling is passing props through components that do not use them.
- A few layers are fine. Long chains hurt maintenance.
- Composition (children or element props) is often the simplest fix.
- Context fits widely needed values that change rarely.
- State libraries fit large, frequently updated shared state with selectors.
Common mistakes
- Reaching for context or Redux as soon as props pass through two levels.
- Putting every value in one global context, which re-renders many components.
- Passing the whole object when a child needs one field.
- Calling any prop passing "bad". Passing props is how React data flows.
Follow-ups
- What are the re-rendering downsides of context?
- When is a state library justified over context?
- How does the children prop help with drilling?
Tips
- Say that prop drilling is acceptable at small depth. It shows balance.
- Show composition before context. Many candidates only know context.
- Compare the three fixes by how often the data changes.