Sign in Go Pro

Build a React Native Application

Consuming a Node.js HTTP API in React Native

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



Most mobile apps will require some type of network calls. We use fetch to make an HTTP call to a simple REST API server.

The server can get and update tasks, and uses JSON to communicate data back and forth with React Native.

Server Code

ToDo API server here

Summary of Content:

  • Download and run the simple HTTP server
  • Use fetch to call the server and get a list of todo items
  • Modify the existing components to account for the new data structure
  • Mark tasks as completed with a PUT request
  • Make new tasks with a POST request




When using the Android emulator, as you mentioned, you replace localhost, I think you replace it with: (I found this on StackOverflow, and also noticed, this is IP the reloader is reporting when I reinstall the app). Hope this helps some Android folks.

Hello Chris.

Unfortunately my app is in infinite loop. See:

I copied all your source code, and run the server as explained in the video. Yet, the app is in infinite loop.

Any tips here?

Oh, nope! I know what it is - you have localhost in there, but the android emulator doesn't work with "localhost" (it has it's own localhost) - so use the actual local ip address of your computer there instead.

I am running in a physical device, my Nexus 5X.

Hm - can you, in the component did mount, print the response to the server call? My guess is something is going wrong there (so, line 27 in the screenshot you sent)

Now I solved, replacing "localhost" per the IP of my machine.

I got my IP using the command " ifconfig | grep inet" on Mac OS X.

Then, I created a constant to store this IP, following the instructions from this post:

You need to go PRO to post comments.

Lessons in Build a React Native Application