score:2

Accepted answer

Problem is that http://dummy.restapiexample.com/api/v1/employees returns array while https://randomuser.me/api/ returns object. Try changing to

componentDidMount() {
    Axios.get("https://randomuser.me/api/").then(res => {
      const results = res.data.results;
      this.setState({ results });
      console.log(results);
    });
  }

score:0

You have to use res.data.results. It comes in results object.

score:0

Please check your JSON data last line you missed the "}]" typo error in http://dummy.restapiexample.com/api/v1/employees

componentDidMount() {
    Axios.get("http://dummy.restapiexample.com/api/v1/employees").then(res => {
      const results = res.data;
      this.setState({ results: results });
    });
  }

Related Query

More Query from same tag