- Build a component that is passed data via props with an effect hook that watches for changes to a props value
- In
PeopleListItem.js
, implement auseEffect
hook that runs when theperson
prop changes. The effect should make afetch
request to thehomeworld
url property on the person object. Thehomeworld
state should be set to the name of the planet returned from the request. - In
PlanetsListItem.js
, implement auseEffect
hook that runs when theplanet
prop changes. The effect should make afetch
request to the first film url in thefilms
property on the planet object. ThefirstFilm
state should be set to thetitle
of the film returned from the request. - In
StarshipsList.js
, implement auseEffect
hook that runs when thestarship
prop changes. The effect should make afetch
request to the first pilot url in thepilots
property on the starship object. ThefirstPilot
state should be set to thename
of the pilot returned from the request. If there are no pilots for that ship, "no pilots" should be displayed.
- In
StarshipsList.js
, update your solution to fetch and display all pilots of that ship. Your state should be an array of pilots. Your solution should make multiple fetch requests, one for each pilot, and update the state only once all fetch requests have completed.