Composition
6 items tagged with "composition"
Patterns6
Decorator
Attaches additional responsibilities to an object dynamically by wrapping it, providing a flexible alternative to subclassing for extending behavior.
Mixin
Composes reusable units of behavior into a class without inheritance, letting unrelated classes share functionality by mixing in shared method sets.
Higher-Order Component (HOC)
A function that takes a component and returns a new component with added behavior, enabling cross-cutting concerns to be shared without inheritance.
Render Props
A component shares logic by accepting a function prop that it calls with internal state, letting the caller control rendering while reusing behavior.
Custom Hooks
Extracts reusable stateful logic from React function components into named hook functions, sharing behavior without wrapper components or prop drilling.
Compound Components
A set of components that work together and share implicit state through context, giving consumers a flexible, declarative API for a composite widget.