CodingNic

Build the Forecast

Pass Forecast Data into `Forecast`

Build the Forecast 10 min read

Pass Forecast Data into `Forecast`

Task

Connect the stored forecast response to the existing component.

File / section

src/App.jsx

Change

Add const [forecast, setForecast] = useState(null); if it is not already present, then render <Forecast data={forecast} unit={unit} /> only when both weather and forecast exist.

Why this change matters

The forecast component receives the complete API response and can handle grouping itself.

Test it

Search for a city and confirm the forecast section appears.

Checkpoint

The forecast component receives live forecast data.