I have been trying to get data from the api using axios get request but it keeps on giving me error. The error is TypeError: this.setstate is not a function i have seen multiple queries about it and almost all of them had done it this way but i cant figure out what iam doing wrong.
My code for axios get
import React, { Component, Fragment } from 'react';
import axios from 'axios'
class Questionare extends Component {
constructor(props) {
super(props);
this.state = {
items: [],
}
}
componentDidMount() {
axios.get('http://leaty-dev.azurewebsites.net/api/services/app/PersonalityQuestionerCategory/GetAllPersonalityQuestionerCategory')
.then(response => {
console.log(response);
this.setstate({items: response.data})
})
.catch(error => {
console.log(error);
});
}
render() {
return (
<ul>
{this.state.items.map(item=>(
<li>{item.pqcDetail}</li>
))}
</ul>
)
}
}
export default Questionare;
response.json()