Composition vs Inheritance – React
reactjs.org · 874 words · saved by 1 readers
A JavaScript library for building user interfaces
These docs are old and won’t be updated. Go to react.dev for the new React docs. React has a powerful composition model, and we recommend using composition instead of inheritance to reuse code between components. In this section, we will consider a few problems where developers new to React often reach for inheritance, and show how we can solve them with composition. Containment Some components don’t know their children ahead of time. This is especially common for components like Sidebar or Dialog that represent generic “boxes”. We recommend that such components use the special children prop t
saved by
related reading
- Tutorial: Tic-Tac-Toe – Reactreactjs.org
- Tao of React - Software Design, Architecture & Best Practices | Alex Kondovalexkondov.com
- Favoring Composition Over Inheritance In Java With Examples - GeeksforGeeksgeeksforgeeks.org
- How Props Work in React – A Beginner's Guidefreecodecamp.org
- Blogged Answers: A (Mostly) Complete Guide to React Rendering Behavior · Mark's Dev Blogblog.isquaredsoftware.com
- Why React Re-Renders • Josh W. Comeaujoshwcomeau.com
- Making Sense of React Server Components • Josh W. Comeaujoshwcomeau.com
- Useful Patterns by Use Case | React TypeScript Cheatsheetreact-typescript-cheatsheet.netlify.app
- Implementing React from scratchrob.directory
- RSC From Scratch. Part 1: Server Components · reactwg server-components · Discussion #5github.com
- Building Bulletproof React Components - Shu Dingshud.in
- How to Steal Any React Componentfant.io