From 5b36edc706cc2fe618a4869f4bb1e41685c75bfc Mon Sep 17 00:00:00 2001 From: Website Deployment Script Date: Sat, 22 Feb 2020 01:19:21 +0000 Subject: [PATCH] Deploy website Deploy website version based on d8ed2e39b53fa642afff6b707909a1bdd7f73b5d --- docs/next/network.html | 87 ++++++++++++++++++++++++++++++++---- docs/next/network/index.html | 87 ++++++++++++++++++++++++++++++++---- 2 files changed, 158 insertions(+), 16 deletions(-) diff --git a/docs/next/network.html b/docs/next/network.html index e5bb284bbd0..4a550ee342d 100644 --- a/docs/next/network.html +++ b/docs/next/network.html @@ -92,31 +92,42 @@

Handling the response

The above examples show how you can make a request. In many cases, you will want to do something with the response.

Networking is an inherently asynchronous operation. Fetch methods will return a Promise that makes it straightforward to write code that works in an asynchronous manner:

-
function getMoviesFromApiAsync() {
+
function getMoviesFromApi() {
   return fetch('https://facebook.github.io/react-native/movies.json')
     .then((response) => response.json())
-    .then((responseJson) => {
-      return responseJson.movies;
+    .then((json) => {
+      return json.movies;
     })
     .catch((error) => {
       console.error(error);
     });
 }
 
-

You can also use the proposed ES2017 async/await syntax in a React Native app:

-
async function getMoviesFromApi() {
+

You can also use the async / await syntax in a React Native app:

+
async function getMoviesFromApiAsync() {
   try {
     let response = await fetch(
       'https://facebook.github.io/react-native/movies.json',
     );
-    let responseJson = await response.json();
-    return responseJson.movies;
+    let json = await response.json();
+    return json.movies;
   } catch (error) {
     console.error(error);
   }
 }
 

Don't forget to catch any errors that may be thrown by fetch, otherwise they will be dropped silently.

+
+
    + + +
+
+

+ >

+

+

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) you will first need to add an App Transport Security exception. If you know ahead of time what domains you will need access to, it is more secure to add exceptions only 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.

Using Other Networking Libraries

diff --git a/docs/next/network/index.html b/docs/next/network/index.html index e5bb284bbd0..4a550ee342d 100644 --- a/docs/next/network/index.html +++ b/docs/next/network/index.html @@ -92,31 +92,42 @@

Handling the response

The above examples show how you can make a request. In many cases, you will want to do something with the response.

Networking is an inherently asynchronous operation. Fetch methods will return a Promise that makes it straightforward to write code that works in an asynchronous manner:

-
function getMoviesFromApiAsync() {
+
function getMoviesFromApi() {
   return fetch('https://facebook.github.io/react-native/movies.json')
     .then((response) => response.json())
-    .then((responseJson) => {
-      return responseJson.movies;
+    .then((json) => {
+      return json.movies;
     })
     .catch((error) => {
       console.error(error);
     });
 }
 
-

You can also use the proposed ES2017 async/await syntax in a React Native app:

-
async function getMoviesFromApi() {
+

You can also use the async / await syntax in a React Native app:

+
async function getMoviesFromApiAsync() {
   try {
     let response = await fetch(
       'https://facebook.github.io/react-native/movies.json',
     );
-    let responseJson = await response.json();
-    return responseJson.movies;
+    let json = await response.json();
+    return json.movies;
   } catch (error) {
     console.error(error);
   }
 }
 

Don't forget to catch any errors that may be thrown by fetch, otherwise they will be dropped silently.

+
+
    + + +
+
+

+ >

+

+

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) you will first need to add an App Transport Security exception. If you know ahead of time what domains you will need access to, it is more secure to add exceptions only 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.

Using Other Networking Libraries