Course contentsShow
← React
Lesson 1165 of 2,39630. Composition: Inversion of ControlFree lesson

The Problem: Too Many Individual Props

Understand why passing a dozen separate props (onClick, onKeyDown, aria-*) creates a poor developer experience.

The Problem: Too Many Individual Props

What you'll learn: Why passing dozens of separate props to enable proper behavior creates a frustrating developer experience.

The Burden of Prop Explosion

Imagine you're building a flexible component library. You want users to be able to customize everything — click handlers, keyboard shortcuts, ARIA attributes, styling hooks, focus management, etc. The straightforward approach is to accept a prop for each concern:

<Dropdown
  onClick={handleClick}
  onKeyDown={handleKeyDown}
  onFocus={handleFocus}
  onBlur={handleBlur}
  role="listbox"
  aria-expanded={isOpen}
  aria-haspopup="true"
  aria-labelledby="dropdown-label"
  tabIndex={0}
  id="my-dropdown"
  className="custom-class"
/>

This quickly becomes exhausting. Users must remember and wire up a dozen props just to get basic functionality working correctly. Miss one accessibility attribute? The component breaks for screen readers. Forget a keyboard handler? Navigation fails.

Why This Hurts

  1. Cognitive overload: Developers spend more time reading docs than building
  2. Error-prone: Easy to forget required props, causing subtle bugs
  3. Repetitive: The same 10+ props get copied everywhere
  4. Maintenance nightmare: Component updates require changing every usage site

Think of it like assembling furniture where every screw, bolt, and washer must be ordered separately and installed manually — technically possible, but nobody wants to work that way.

The Core Issue

When a component needs coordinated behavior (like accessibility + interaction + state management), individual props force users to understand and implement that coordination themselves, repeatedly, at every usage site.

Key Takeaway: Passing numerous individual props for related functionality creates poor developer experience through cognitive overload, repetition, and error-prone manual coordination. This motivates patterns that bundle coordinated props together.