Command Palette

Search for a command to run...

Hectal
Phase 1: JSX: Writing UI in JavaScript
React · Exercise 6 of 6 Previous
Intermediate

Mini build: a weekly forecast

Build the forecast from the week array. Use week.map(...) to create the rows (you'll study lists properly in Phase 3; here, each item needs a key).

Render a <dl className="week" aria-label="Weekly forecast"> that contains only <dt>/<dd> pairs, no wrapper elements: a <dt> with the day name and a <dd> for each day.

Each <dd> contains an SVG icon with aria-hidden="true" (use the SunIcon component provided, fixing its attributes) followed by the temperature as text like 31°C. Give each <dd> a data-temp attribute with the number, and the class hot when the temperature is 30 or more.

The console must show no React warnings.

What Check tests

  1. The <dl> holds only dt/dd pairs, one per day
  2. The list is labelled Weekly forecast
  3. Each day shows its temperature like 31°C
  4. Each dd has a hidden SVG icon
  5. data-temp holds the number and only 30°C or more is hot
  6. The console has no React warnings

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.