showing results for - "async wait for axios reactjs"
Gaia
24 Jul 2017
1useEffect(() => {
2  async function fetchData() {
3    // You can await here
4    const response = await MyAPI.getData(someId);
5    // ...
6  }
7  fetchData();
8}, [someId]); // Or [] if effect doesn't need props or state