Composition vs Inheritance in React
React’s docs say: use composition, not inheritance, for UI. Pass children, render props, or small wrapper components. <Card><h2>Shoes</h2></Card> instead of class SaleCard extends Card. You reuse Card’s shell without a class tree.
Inheritance still exists in JS, but UI ‘is-a’ chains get brittle. Share logic with hooks, share layout with children.
Composition vs Inheritance in React — on screen: Shoes + 20% off inside Card. children is the composition knob.
children example vs extends.