import React, { Component } from 'react';
import Axios from 'axios';
class AxiosUser extends Component {
getUserData=()=>{
Axios.get("https://jsonplaceholder.typicode.com/users").then(result => {
console.log(result.data);
},
(error) => {
console.log(error);
}
)
}
render() {
return <div className='container'>
<div className='row mt-5'>
<div className='col'>
<button className='btn btn-primary' onClick={this.getUserData}>Get Data</button>
</div>
</div>
</div>;
}
}
export default AxiosUser;
PostedBy: pankaj_bhakre
No comments:
Post a Comment