官术网_书友最值得收藏!

Networking in React Native

Most mobile apps need to fetch and update data from an external URL. There are several npm modules, which can be used in React Native to communicate and download remote resources such as Axios or SuperAgent. If you are familiar with a specific HTTP library, you can use it in your React Native projects (as long as is not dependent on any browser specific APIs), although a safe and proficient option is to use Fetch, the built-in networking library in React Native. 

Fetch is very similar to XMLHttpRequest, so it will feel familiar to any web developers who had to perform AJAX requests from the browser. On top of that, Fetch supports promises and the ES2017 async/await syntax. 

The full documentation for the Fetch API can be found on Mozilla Developer Networks website https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API.

By default, iOS will block any request that's not encrypted using SSL. If you need to fetch from a cleartext URL (one that begins with http instead of https), you will first need to add an App Transport Security ( ATS) exception. If you know ahead of time what domains you will need access to, it is more secure to add exceptions just for those domains; if the domains are not known until runtime, you can disable ATS completely. Note, however, that from January 2017, Apple's App Store review will require reasonable justification for disabling ATS. See Apple's documentation for more information.
主站蜘蛛池模板: 开阳县| 达州市| 额济纳旗| 新郑市| 广丰县| 贵溪市| 淮北市| 宁晋县| 德昌县| 嘉兴市| 八宿县| 澄迈县| 蛟河市| 营山县| 通化市| 永顺县| 固阳县| 罗源县| 山东| 荆门市| 桃园市| 新昌县| 原阳县| 云南省| 岚皋县| 崇阳县| 新乡县| 鄢陵县| 福州市| 闽侯县| 上虞市| 朝阳区| 鞍山市| 慈溪市| 芜湖市| 彩票| 钦州市| 宿松县| 扎兰屯市| 邢台县| 万安县|