📜  异步等待 axios reactjs - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:29.945000             🧑  作者: Mango

代码示例1
useEffect(() => {
  async function fetchData() {
    // You can await here
    const response = await MyAPI.getData(someId);
    // ...
  }
  fetchData();
}, [someId]); // Or [] if effect doesn't need props or state