如何为API添加图片Url、标题和描述?

问题描述 投票:0回答:0

我正在尝试向 API 添加 imgUrl、给定的标题和描述。

import "./App.css";
import axios from "axios";
import React, { Component } from "react";
import ToDoList from "./Components/ToDoList";

class App extends Component {
  state = {
    todo: [],
  };

  componentDidMount() {
    this.getData();
  }

  getData = () => {
    axios
      .get("https://api.vschool.io/oscarc/thing")
      .then((res) => this.setState({ todos: res.data }))
      .catch((err) => console.log(err));
  };

  render() {
    return (
      <div>
        <ToDoList />
      </div>
    );
  }
}
javascript reactjs api post axios
© www.soinside.com 2019 - 2024. All rights reserved.