小编Ngu*_* Vũ的帖子

传递函数样式之间的差异

这些函数调用样式之间有什么区别?

onPress = { () => { this.myFunctions() } }
Run Code Online (Sandbox Code Playgroud)

onPress = { this.myFunctions() }
Run Code Online (Sandbox Code Playgroud)

javascript react-native

5
推荐指数
1
解决办法
91
查看次数

'fetch' 未定义。 eslint(no-undef) in react-native

我在 react native 中使用 fetch 并有一条消息:'fetch' is not defined.eslint(no-undef)

我的代码:

getData() {
fetch('https://tutorialzine.com/misc/files/example.json', {})
  .then(res => res.json())
  .then((res) => {
    console.log(res);
  }).catch((e) => {
    console.log(e);
  });
Run Code Online (Sandbox Code Playgroud)

}

我该如何解决?和 console.log 不显示数据

fetch react-native

4
推荐指数
2
解决办法
5712
查看次数

标签 统计

react-native ×2

fetch ×1

javascript ×1