I need to convert responseJson.result (JSON Object) to data (JS Object).
When I use console log or alert it's return undefined.
I don't know what's wrong - something about console log or alert method or stringify?
constructor() {
super();
this.state = {
data: null,
};
}
componentWillMount() {
return fetch("www.abc.xyz/api")
.then((response) => response.json())
.then((responseJson) => {
let ds = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1 !== r2
});
this.setState({
data: JSON.stringify(responseJson.result),
}, function() {
});
var resultJ = this.state.data.result;
alert(resultJ);
})
.catch((error) => {
alert("0 : Recrods On This Module ")
});
}