LoginSignup
0
1

More than 3 years have passed since last update.

axios

Posted at
  • fetchと類似
class App extends React.Component {
  constructor(props){
    super(props)
    this.state = {
      data: []
    }
  }

   componentWillMount(){
     axios.get('https://api.github.com/users/KrunalLathiya')
       .then(res => this.setState({data: res["data"]}))
   }

  render(){
    const {login, id, avatarurl} = this.state.data
    return (
      <div className="App">
       <div>
        {login}
       </div>
       <div>
        {id}
       </div>
       <div>
        {avatarurl}
       </div>
      </div>
    );
  }
}

参考記事

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1