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.
Summary of Content:
- Download and run the simple HTTP server
fetchto 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
- Make new tasks with a
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.
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: