Frontend with React
🧩 Composition: children and slots
Compose interfaces by combining components: props.children for arbitrary content, slots via props, and the composition patterns React prefers over inheritance.
What you'll learn
- Compose container components by wrapping arbitrary content with
props.children - Fill multiple zones of a component by passing JSX elements via props (slots)
- Choose between
childrenand slots depending on whether there are one or several zones to fill - Apply composition instead of inheritance to reuse and specialize components
Lessons
props.children and container componentsWrap arbitrary content. Slots: passing elements via propsThe 'holes' pattern. Composition vs inheritanceCombine components, don't extend them.Practice this module in the app
DevPath is a hands-on course: you read the theory here; in the app you put it into practice with exercises that really run, offline.
Start free in the app →