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>
)
}
}
Also in JavaScript:
- kill all node processes
- join array js
- tableau js api
- lazy react
- most used events in javascript
- react native multiple touchableopacity
- angular An accessor cannot be declared in an ambient context.
- js detect os
- take a screen shot of a image within a div using js
- Javascript singly linked list
- angular import service
- javascript get intersection of two arrays
- rounding number to x decimals javascript
- communication child to parent react js
- listerner content loaded js
- new Map() collection in react state
- dimensions react native
- what is node.js
- cookie clicker hack
- javascript log to console
- clear terminal node js
- how to write a json in r
- how to import jquery in js file
- big o theory