
Stop building "God Components" with 30 props. Sometimes the best API is no API at all. Let's explore why composition beats configuration for maintainable React systems.
We've all seen them: the "God Components." A single <Button /> or <Card /> with 20+ props, half of them optional, creating a configuration nightmare. You start with title, then add hasIcon, then iconPosition, then isLoading... before you know it, youβre debugging a labyrinth of if/else statements inside your JSX.
Every new prop you add to a component increases its complexity exponentially:
π Combinatorial Explosion: 10 boolean props mean 1,024 possible states to test.
π Leaky Abstractions: Your component starts caring about things it shouldn't.
π Rigidity: Want to add a sub-title? Now you need a subTitle prop and a subTitleStyle prop.
Instead of trying to predict every future use case with props, give the power back to the developer using the component.
β The Configuration Nightmare (Rigid)
TypeScript
β The Composition Dream (Flexible)
TypeScript
Inversion of Control: The consumer decides the structure, not the component author.
Reduced Surface Area: Your base component only manages state/logic; the layout is handled by the children.
No More "Prop Drilling": You don't need to pass a titleClassName through 3 layers just to change a font size.
Props are for state and identity, not for structure.
π Use Props for: size, color, isDisabled, onClick.
π Use Composition for: Layout, nesting, and complex internal structures.
Think of your components as LEGO bricks, not as pre-built machines. A machine has limited settings; bricks can become anything. Build bricks.