From the course: React Native Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using the Fetch API

Using the Fetch API - React Native Tutorial

From the course: React Native Essential Training

Start my 1-month free trial

Using the Fetch API

- [Instructor] We're ready to fetch the data and see what we're working with. I'll create a new file under source and call this file Ajax.JS. And this is the file where we're going to do all the Ajax requests that are to be used by the app. So we'll export a default object here. That is our API. And in this default object, we'll define functions responsible for fetching different types of data. So let's define the first function. We're interested in fetching the initial deals. So I'm going to call this function fetch initial deals. In this function we want to do an Ajax request to the big sale API. We can use the fetch library to do that. The fetch library comes built in react native so we don't need to import anything. And you can see the documentation for the fetch API under the react native website. So you do fetch, the default method is get but you can change it if you need to. Once you have the initial response…

Contents