Created
April 1, 2021 17:13
-
-
Save LuffyAnshul/ddef6d5673a046dc37ef1aca86736780 to your computer and use it in GitHub Desktop.
WildFire Tracker App JS File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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