Answers for "how to install axios in react"

5

import axios

import axios from "axios";
Posted by: Guest on May-12-2020
13

axios js and react

import React from 'react';

import axios from 'axios';

export default class PersonList extends React.Component {
  state = {
    persons: []
  }

  componentDidMount() {
    axios.get(`https://jsonplaceholder.typicode.com/users`)
      .then(res => {
        const persons = res.data;
        this.setState({ persons });
      })
  }

  render() {
    return (
      <ul>
        { this.state.persons.map(person => <li>{person.name}</li>)}
      </ul>
    )
  }
}
Posted by: Guest on April-13-2020
3

import axios react

import axios from 'axios';
Posted by: Guest on February-26-2021
1

how to install axios in react

$ yarn add axios
Posted by: Guest on June-18-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language