我是React原生的新手,我试着打电话:
fetch('https://rallycoding.herokuapp.com/api/music_albums')
.then((response) => response.json())
.then((responseData) => {
console.log(`TEST RESPONSE: ${responseData}`);
});
获取API并将其记录到调试 . 我希望看到结果的细节就像在教程中一样,但我得到的结果如下:
TEST RESPONSE:[object Object],[object Object],[object Object],[object Object],[object Object]
它应该是这样的,我可以扩展数据以查看数组:
但是,结果可以正常使用并填充到列表中 .
我在用
react-native-cli:2.0.1反应原生:0.56.0
我做错了什么?感谢您的时间 .
1 回答
你必须用
console.log('TEST RESPONSE:', responseData)
打印它