STAGE 02 / LESSON 02
React components and props
A component describes a reusable part of the interface.
THE IDEA
Understand it.
Here we use React function components: JavaScript functions that return UI. A parent passes values to a child through props. The child renders from those inputs rather than changing the parent’s data directly.
Break components around meaningful responsibilities: a task list can render task rows, while each row receives one task and a handler. Render lists with a stable key from the data, not a randomly generated value on every render.
SEE IT IN CONTEXT
Pass task data to a component
type Props = { title: string; done: boolean };
function TaskRow({ title, done }: Props) {
return <li>{title} — {done ? "Done" : "Open"}</li>;
}
<TaskRow title="Review API" done={false} />The parent owns the values; the component renders the supplied title and status.
LEARN FROM REAL WEBSITES
See it in the real world.
These simplified structures come from public sources. Company systems change, and the sources may describe only one project or an earlier design.
GitHub
Public code checked November 2026Shared interface components
Primer React is GitHub's open-source React implementation of its design system.
- Application
- Primer React component
- Rendered interface
What to learn: Reusable components let teams share behavior and presentation; the public library shows the component boundary.
Read the source: Primer ReactSpotify
Spotify engineering, 2021One interface, two clients
Spotify described a React interface shared by the Web Player and desktop client in 2021.
- Shared React UI
- Platform APIs
- Web or desktop client
What to learn: Separating UI from platform-specific capabilities lets components be reused across environments.
Read the source: Spotify desktop and web architectureTRY IT YOURSELF
Practice.
How would you show a different task without changing TaskRow?
Show one possible answer
Render another TaskRow with different prop values, for example title='Write tests' and done=true.
GO DEEPER