Skip to content
Learn Netverks

Lesson

Step 9/36 25% through track

children-composition

Children and composition

Last reviewed May 28, 2026 Content v20260528
Track mode
client_react
Means
In-browser React TSX
Reading
~1 min
Level
intermediate

This lesson

This lesson teaches Children and composition: the concepts, APIs, and habits you need before advancing in React.

Without Children and composition, you will struggle to read or extend React codebases and playground exercises.

You will apply Children and composition in contexts like: SPAs, dashboards, design-system-driven products, and React Native mobile apps.

Write TypeScript/TSX, click Run in browser—React 18 loads from CDN, JSX compiles in the tab, UI renders in the preview root, and printOutput feeds the terminal.

When you can explain the previous lesson's ideas without copying starter code.

children is a special prop: whatever you nest between opening and closing tags. It enables flexible layouts—shells, panels, and slots—without prop explosion.

Patterns

function Panel({ title, children }: { title: string; children: React.ReactNode }) {
  return (
    <section>
      <h2>{title}</h2>
      {children}
    </section>
  );
}

<Panel title="Notes">
  <p>Any JSX can go here.</p>
</Panel>

Composition vs configuration

Prefer passing JSX as children or named slots (header={...}) over dozens of boolean props like showFooter, footerText, footerIcon.

Self-check

  1. What is the type of children in TypeScript?
  2. When would you use a named prop instead of children?

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • children vs prop slot?
  • Composition win?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump