diff --git a/releases/next/docs/network.html b/releases/next/docs/network.html index f5011922b1e..20e9ceff612 100644 --- a/releases/next/docs/network.html +++ b/releases/next/docs/network.html @@ -9,7 +9,7 @@ secondParam: 'yourOtherValue', }) })

Take a look at the Fetch Request docs for a full list of properties.

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 make it straightforward to write code that works in an asynchronous manner:

getMoviesFromApiAsync() { - return fetch('http://facebook.github.io/react-native/movies.json') + return fetch('https://facebook.github.io/react-native/movies.json') .then((response) => response.json()) .then((responseJson) => { return responseJson.movies; @@ -19,7 +19,7 @@ }); }

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

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