Location Details
Overview
In this step we are going to create the first component that we outlined in the last step - <LocationDetails />
.
Forecast static data
In order to do anything, we will need access to the forecast data, so let's load that in. Copy the contents of the external forecast.json
file into a new file src/data/forecast.json
.
Requirements
We outlined this feature as follows:
Users should be able to see the name and country of the city the forecast is for.
Technical task breakdown
In order to complete this step, you should do the following tasks:
- Import static data and pass it to
<App />
as a prop. - Create a new file
LocationDetails.js
in your components directory. - Inside that file, create a component called
<LocationDetails />
, which uses JSX to render values stored inprops.city
andprops.country
inside of a<h1>
tag. Give your<h1>
tag an appropriate class name. Export the<LocationDetails />
component from the file. - Import the
<LocationDetails />
component intoApp.js
. - Update the
<App />
component, so that it renders<LocationDetails />
using JSX. - Pass
props.location.city
andprops.location.country
from<App />
into<LocationDetails />
.