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

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.
主站蜘蛛池模板: 阳山县| 葫芦岛市| 江源县| 禄丰县| 新乐市| 财经| 贡山| 沙河市| 义乌市| 长汀县| 新野县| 义乌市| 丰原市| 澳门| 卓资县| 钟山县| 平塘县| 道孚县| 渑池县| 和平县| 鄂托克旗| 克什克腾旗| 昭觉县| 建湖县| 都江堰市| 玉山县| 万盛区| 台东市| 鸡东县| 嘉禾县| 安平县| 贡觉县| 五寨县| 汶上县| 韶关市| 喜德县| 江达县| 芒康县| 克拉玛依市| 弋阳县| 建阳市|