Course contentsShow
← React
Lesson 271 of 2,3968. Props PatternsFree lesson

Drilling and TypeScript Noise

See how prop drilling creates verbose type definitions in components that don't care about the data.

Drilling and TypeScript Noise

You'll learn how prop drilling creates extra TypeScript overhead in components that merely pass data through.

The Typing Tax on Intermediaries

When you drill props through multiple components in TypeScript, every component in the chain needs type definitions—even components that don't actually use those props. This creates verbose, noisy code where intermediate components become cluttered with types they don't care about.

The Noise in Action

Imagine drilling a userId from a grandparent to a grandchild:

interface GrandchildProps {
  userId: string;
}

// Grandchild actually uses the prop
function Grandchild({ userId }: GrandchildProps) {
  return <div>User: {userId}</div>;
}

interface ParentProps {
  userId: string; // ← Noise: Parent doesn't care about this
}

// Parent just passes it through
function Parent({ userId }: ParentProps) {
  return <Grandchild userId={userId} />;
}

interface GrandparentProps {
  userId: string;
}

function Grandparent({ userId }: GrandparentProps) {
  return <Parent userId={userId} />;
}

The Parent component is forced to declare userId in its interface despite never reading or using that value. It's just a courier.

Why This Hurts

As drilling deepens, you end up maintaining type definitions in 5+ components when only one actually cares about the data. Each intermediate component's interface becomes polluted with props that exist solely for passing along. Change the type once, and you update it everywhere in the chain.

Key Takeaway: Prop drilling in TypeScript forces every intermediate component to declare types for data it doesn't use, creating maintenance overhead and obscuring each component's actual dependencies.