Hint
Props pass data down; drilling = passing through many layers just to reach a deeply nested child
Props are the inputs to a component — passed from parent to child. They are read-only (immutable from the child's perspective).
function Button({ label, onClick, disabled = false }) {
return ;
}
// Usage
Prop drilling — passing props through intermediate components that don't need them, just so a deep child can access them:
// ❌ Drilling — Middle doesn't need user, just passes it down
function App() {
const user = { name: 'Alice' };
return ;
}
function Middle({ user }) {
return ;
}
function Deep({ user }) {
return {user.name}
;
}
Solutions to prop drilling:
children or render props — often eliminates drilling without the overhead of a context.