📌  相关文章
📜  axios 将 api 放入 componentDidMount React - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:47.247000             🧑  作者: Mango

代码示例1
componentDidMount() {
    // Simple PUT request with a JSON body using axios
    const article = { title: 'React PUT Request Example' };
    axios.put('https://reqres.in/api/articles/1', article)
        .then(response => this.setState({ updatedAt: response.data.updatedAt }));
}