Let's fetch some fresh data for our React Native Apps

One of the basic concept for any modern App is Networking. In your React Native Apps you're going to be provided with some alternatives, but here we'll boil them down to a single one, let's go through them.


React Native implements this polyfill in order to be compatible with the browser API, this also means that any (npm) package that doesn't depend on Browser or Node specifics API can also be installed into your app. See axios or frisbee.
As you might already be used in your Web Development, you're most likely never going to use this low-level API.


WebSocket let you open a two way (real-time) communication with the server.
That's pretty cool, but you're going to need a different Back-end architecture.
If you're asking yourself if this suits you, then move on.


fetch is a new standard still in the making, but it's already available in React Native by default.
For this, and its saner API, you're likely going to encounter it in many Apps dealing with external data.

So now that we have a winner, how do we get started working with fetch?

Official React Native Tutorial

This tutorial aims to get you up to speed with writing iOS and Android apps using React Native. If you're wondering what React Native is and why Facebook built it, this blog post explains that.

Interacting with APIs Using React Native Fetch blog post by Yoni Weisbrod

Fetch is a fantastic networking API that was chosen for React Native, but because it is relatively new, there are a few things to be aware of when using it. The React Native Documentation does include a single example, which is a good start, but I want to add a few more things that may not be readily obvious.

Make HTTP Requests With React Native blog post by Nic Raboy

The Facebook documentation for React Native has (or had at the time of writing this) a tutorial for getting movie data from a remote API.  However, it hardly explained how to customize the HTTP request.  In fact, I found that a lot of the internet was missing clear cut documentation for RESTful requests with React.

This article should clear things up!

Again, you can also learn by reading other's people code, through some Open Source Apps that deal with external data.