View Code? Open in Web Editor
NEW
This project forked from boolean-uk/react-use-effect-dependencies-practice-1
JavaScript 84.50%
CSS 4.58%
HTML 10.92%
react-use-effect-dependencies-practice-1's Introduction
- Build a component with an effect hook that watches for changes to a given value and triggers the effect
- Fork this repository
- Clone the forked repository onto your local machines
- In the root directory, type
npm ci
, which installs dependencies for the project
- Finally, type
npm run dev
, which starts a development server that runs your website in the browser.
- In
App.jsx
set up a useEffect
to run whenever the dataType
state is changed
- When the effect is triggered, make a
fetch
request to https://swapi.dev/api/${dataType}/
- NOTE: you must include the ending
/
in your API URL
- The string values which
dataType
can have are: people
, planets
and starships
- Store the returned JSON data in the
data
state using setData
react-use-effect-dependencies-practice-1's People