Stage 2 · Lesson 4 of 8
Components, JSX and props
A interface is a tree of . A component is a function that takes props (its inputs) and returns JSX, which looks like and describes what should appear. Props flow one way, from parent to child.
A component should never change the props it receives. Learn to split a screen into components, one per job. To render a list, use map and give each item a stable key: an id from your data, not the array position, when items can move.
To show something only sometimes, use && or a ternary (a ? b : c). The children prop lets you build a wrapper, like a Card or Layout, that can hold anything. In the first stage you changed the (the page's live structure) by hand.
Here React updates it for you. The new question is where each piece of data should live, which the next topic answers.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- GuideFreeReact Documentation
Meta
Free official course; Thinking in React and Managing State matter most
- CourseFreeFull Stack Open
University of Helsinki · Intermediate
Free: Parts 0 to 2 cover web basics, React and talking to a server