Missing function tags
Summary: It seems like it's not written in es6, hence no arrow functions, therefor we must have the function tag for it to work? Closes https://github.com/facebook/react-native/pull/9463 Differential Revision: D3736797 fbshipit-source-id: c41bbd5f6867aa0f7668f8562e69dc2812eba80a
This commit is contained in:
parent
4b6af5fa63
commit
aacfc372c9
|
@ -47,7 +47,7 @@ The above examples show how you can make a request. In many cases, you will want
|
|||
Networking is an inherently asynchronous operation. Fetch methods will return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that make it straightforward to write code that works in an asynchronous manner:
|
||||
|
||||
```js
|
||||
getMoviesFromApiAsync() {
|
||||
function getMoviesFromApiAsync() {
|
||||
return fetch('https://facebook.github.io/react-native/movies.json')
|
||||
.then((response) => response.json())
|
||||
.then((responseJson) => {
|
||||
|
@ -62,7 +62,7 @@ Networking is an inherently asynchronous operation. Fetch methods will return a
|
|||
You can also use the proposed ES2017 `async`/`await` syntax in a React Native app:
|
||||
|
||||
```js
|
||||
async getMoviesFromApi() {
|
||||
async function getMoviesFromApi() {
|
||||
try {
|
||||
let response = await fetch('https://facebook.github.io/react-native/movies.json');
|
||||
let responseJson = await response.json();
|
||||
|
|
Loading…
Reference in New Issue