反应本地取不工作

问题描述 投票:3回答:1
try {
  fetch(url)
    .then((response) => response.json())
    .then((responseJson) => {

    })
    .catch((error) => {
      console.error("REQ ERROR::: " + error);
    });
} catch (ex) {
  console.error("REQ ERROR::: " + JSON.stringify(ex));
}

但日志说

未定义不是(评价“self.fetch”)的对象

如何解决这个问题?

react-native
1个回答
0
投票

这可能是与npmbuilder缓存的问题。您必须具有取决于whatwg-fetch另一个依赖。

您可以轻松地与npm ls whatwg-fetch检查。

消除被利用whatwg-fetch重新安装它的依赖。还清楚的建设者缓存。如果您使用世博expo start -c

你会找到一些解决办法,说明做:global.self = global。这是不是一个真正的解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.