这些函数调用样式之间有什么区别?
onPress = { () => { this.myFunctions() } }
Run Code Online (Sandbox Code Playgroud)
和
onPress = { this.myFunctions() }
Run Code Online (Sandbox Code Playgroud) 我在 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 不显示数据