【发布时间】:2017-01-09 05:45:09
【问题描述】:
我在 react-native 应用程序中使用 fetch。我正在尝试阅读回复,但是当我使用alert(response) 时,我得到了[object Object]。我尝试过使用其他模块,例如 xml2js、react-native-html-parser' 或 xmldom。
fetch(
/*
REQUEST CONFIGURATION
*/
}).then(response => {
console.log(response) // This is what returns [object Object]
})
【问题讨论】:
-
这里是
Response文档:developer.mozilla.org/en-US/docs/Web/API/Response,尝试使用response.json()或response.text() -
我做了,我收到了同样的结果
-
如果你只是想看内容你应该使用
console.log(response)并使用调试器查看对象。
标签: javascript xml react-native fetch