I am calling service that is using
XML, so i want to parse XML to JSON and the JSON data set as my react state but i am
getting.
TypeError: Cannot read
property 'setState' of
undefined
axios
.get(session_url)
.then(function(response) {
parseString(response.data, (err, result) => {
if (err) {
throw
err;
} else {
this.setState({
odm:
result.data,
loading: false,
});
}
});
})
.catch(function(error) {
console.log(error);
});
No comments:
Post a Comment