我需要将responseJson.result(JSON Object)转换为数据(JS Object) 当我使用控制台日志或提醒它时,返回undefined。
我不知道什么是错的 - 有关控制台日志或警报方法或字符串化的内容?
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 ")
});
}