在我的应用程序中,在componentDidMount()中,我想分派一个操作,它有两个API调用。在angular中,对于可观察对象,我们可以使用forkJoin()来实现此目的。在react / react-native中,我们是否有类似于forkJoin()的方法?如果现在,调用2个API端点的好做法是什么?
发布于 2018-06-04 02:45:51
同样,使用Promise chaining也会很有用。
someApiCall().then(function (bun) {
return addSausage(bun)
}).then(function (bunWithSausage) {
return addSauce(bunWithSausage)
}).then(function (hotdog) {
return hotdog
})
https://stackoverflow.com/questions/50668950
复制相似问题