Reactjs承诺,我们应该如何使用它? [英] Reactjs promises, how should we use it?
本文介绍了Reactjs承诺,我们应该如何使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
过去3天我一直在阅读很多关于React的内容,但我没有看到有关使用承诺的更多信息,所以我有这个顾虑。
I've been reading a lot about React for the last 3 days, but I don't see much information about the use of promises, so I have that concern.
有没有这个库?
我应该如何在React中使用promises?
How should I use promises in React?
推荐答案
React没有像Angular那样带有 $ http
的承诺库。你必须找到你自己的。
React doesn't come with a promise library baked in like Angular with $http
. You will have to find your own.
你可以尝试一些:
- Bluebird (个人推荐)
- jQuery的
$ ajax
- 原生承诺(除非您实际需要支持IE): http://caniuse.com/#feat=promises
- Bluebird (personal recommendation)
- jQuery's
$ajax
- Native promises (unless you actually have to support IE): http://caniuse.com/#feat=promises
这篇关于Reactjs承诺,我们应该如何使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文