Skip to content

Instantly share code, notes, and snippets.

@LuffyAnshul
Created April 1, 2021 17:13
Show Gist options
  • Select an option

  • Save LuffyAnshul/ddef6d5673a046dc37ef1aca86736780 to your computer and use it in GitHub Desktop.

Select an option

Save LuffyAnshul/ddef6d5673a046dc37ef1aca86736780 to your computer and use it in GitHub Desktop.
WildFire Tracker App JS File
function App() {
const [eventData, setEventData] = useState([]);
const [loading, setLoading] = useState(false);
useEffect(() => {
const fetchEvents = async() => {
setLoading(true);
const res = await fetch('https://eonet.sci.gsfc.nasa.gov/api/v2.1/events');
const { events } = await res.json();
setEventData(events);
setLoading(false);
}
fetchEvents()
}, [])
return (
<div>
{ !loading ? <Map eventData={eventData} /> : <Loader /> }
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment