我有一个反应本机应用程序,可以加载服务器数据和图像,以及 我使用fetch从API加载数据。
但是,应用程序仅成功加载第一个提取调用,然后无法加载对外部服务器的所有后续调用,包括普通的json提取调用和图像。第一次获取后的任何调用都将暂停
总结如此:
注意:图像和json文件在浏览器上加载
代码示例:
componentDidMount() {
this.fetchA();
this.fetchB();
}
fetchA(url)
.then((response) => response.json())
.then((responseData) => {
console.log(responseData);
})
.catch(error => {
console.log(error);
});
fetchB(url)
.then((response) => response.json())
.then((responseData) => {
console.log(responseData);
})
.catch(error => {
console.log(error);
});
fetchB功能失败
环境:
我google了很长时间但没有任何运气来找出问题的根源。有什么帮助吗?