From b98fc4d9453e0df78f864bc52f4f55d2b10f1ab1 Mon Sep 17 00:00:00 2001 From: Website Deployment Script Date: Sun, 14 Aug 2016 10:52:16 +0000 Subject: [PATCH] Updated docs for next --- releases/next/docs/network.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) {