Skip to main content
Most mobile apps need to load data from remote servers. React Native uses the same fetch API that’s available in web browsers, making it familiar if you’ve done web development.

The Fetch API

React Native includes the Fetch API for making HTTP requests. From the React Native source (Libraries/Network/fetch.js):
fetch.js (from source)

Basic GET Request

Using Async/Await

Modern JavaScript async/await syntax makes network code cleaner:

POST Requests

Sending data to a server:

HTTP Methods

Authentication

Bearer Token Authentication

Complete Auth Example

Error Handling

Request Timeout

Real-World Example: News Feed

WebSocket Support

For real-time communication:

Best Practices

Network requests can fail for many reasons. Always wrap fetch calls in try-catch blocks.
Provide feedback to users while data is loading with ActivityIndicator or skeleton screens.
Check for network errors and show appropriate messages to users.
Cleaner than promises for sequential operations and error handling.
Prevent requests from hanging indefinitely.
Use AsyncStorage or libraries like React Query to cache responses.

Next Steps

Navigation

Learn to navigate between screens in your app

Using Lists

Display network data in efficient lists