Module 1 ยท Components and JSX Lesson 2 of 15
Props, children and composition
Props are the arguments of a component; children is a special prop holding whatever you put between the tags. Composition โ a component that accepts other components โ is what keeps a codebase readable.
Worked example
One <Panel title="Fees"> containing different content each time beats three near-identical Panel components. The prop carries the difference; the component carries the shape.
Your practice task
Turn your four components into reusable ones: one Card used in three places with different props, and one Layout that takes children.
Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.
Key takeaway
Props are the arguments of a component; children is a special prop holding whatever you put between the tags. Composition โ a component that accepts other components โ is what keeps a codebase readable.
Keep your place in this course
A free account saves which lessons you have finished and unlocks the certificate. The lesson itself stays free to read.
Create free account or sign inCourse complete
You finished every lesson.
Your certificate is ready, and the projects you built are the proof to attach to an application.
Almost there
15 lessons left of 15
Finish every lesson to unlock the certificate. Each one ends in a practice task โ do them and the final project brief writes itself.