- Build a component with an effect hook that watches for changes to a given value and triggers the effect
- In
App.js
set up auseEffect
to run whenever thedataType
state is changed - When the effect is triggered, make a
fetch
request tohttps://swapi.dev/api/${dataType}/
- Store the returned JSON data in the
data
state usingsetData