Close the earlier lessons, read the brief, and build it. Use the hints only after you've been stuck for a few minutes.
The brief
Build a page for a study group, with one ProfileCard component used three
times. ProfileCard takes these props:
| Prop | Example | Shown as |
|---|---|---|
name | "Ada" | A heading |
role | "Organiser" | A line under the heading |
minutes | 300 | 5 hours studied. For 0, show Just getting started instead |
isMentor | true | A Mentor badge next to the name, and a highlighted card. Nothing for false |
| children | <p>Ask me about components.</p> | Under the rest, when given |
Show Ada (Organiser, 300 minutes, mentor, with the children above), Grace (Learner, 120 minutes) and Linus (Learner, 0 minutes).
Acceptance checks:
- Only Ada's card has the badge and the highlight.
- Linus's card says Just getting started, not 0 hours studied, and no stray 0 appears anywhere.
- No errors or warnings in the console.
npm install and npm run dev. Hint 1: order of work
Get one card showing name and role first. Then add minutes, then the
badge, then the highlight, then children. Run after each step.
Hint 2: two conditions
The badge is "something or nothing": &&, with a true or false value on the
left. The hours line is "this or that": a ternary. The highlight is a class
chosen with a ternary.
Show one solution
npm install and npm run dev. Check yourself
- What is the difference between
minutes="300"andminutes={300}? Predictminutes + 5for each. Why might division appear to work anyway? - When would you use
childreninstead of a named prop? - Why can
{count && <p>...</p>}show a 0?
Completion is saved in this browser only. It does not measure mastery.