componentDidMount() {
var self = this;
axios.get('http://URL')
.then(function (response) {
console.log(response.data);
this.setState({
data: response.data
})
})
.catch(function (error) {
console.log(error);
});
}
I got this error: TypeError: Cannot read property 'setState' of undefined