小编Tau*_*san的帖子

我得到了一个承诺,以回报 React Native 中的 fetch 调用

我想得到一个 json 文件作为回报。

这是我正在使用的提取函数

handleApi(){
    return 
        fetch('https://facebook.github.io/react-native/movies.json')
            .then((response) => response.json())
                .then((responseJson) => {
            return responseJson.movies;
        })
}
Run Code Online (Sandbox Code Playgroud)

正在按钮单击事件上调用此函数。

handleSubmit() {
    console.log(
        this.handleApi();
    )
Run Code Online (Sandbox Code Playgroud)

但我得到这个 Promise对象作为回报不是预期的数据

Promise {_40: 0, _65: 0, _55: null, _72: null}_40: 0_55: null_6​​5: 0_72: null__proto__: Object

reactjs react-native react-native-ios

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

标签 统计

react-native ×1

react-native-ios ×1

reactjs ×1