Answers for "react native axios"

14

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
4

import axios

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

axios react native

npm i react-native-axios
Posted by: Guest on July-04-2021
6

axios react

$ npm install react-axios
Posted by: Guest on September-14-2020
0

axios

const axios = require('axios').default;

// axios.<method> will now provide autocomplete and parameter typings
Posted by: Guest on December-06-2020

Browse Popular Code Answers by Language