📜  await fetch data componentdidmount - 任何代码示例

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

代码示例1
async componentDidMount() {
    const response = await fetch(`https://api.com/v1/ticker/?limit=10`);
    const json = await response.json();
    this.setState({ data: json });
}