First, there is a small typo in your example. In your component's constructor you specify a loading state variable, but in your render function you're using isLoading. Second, you're not mapping over your data correctly. It just looks like you need to specify what aspects of each movie you care about in your render function. JSX can't handle displaying a full javascript object which is what <Text>{val}</Text> ends up being in your code. There are a few ways you can fix this. It's very common to just map over your results and display them directly.

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      loading: true,
      dataSource: []
    };
  }
  
  componentDidMount() {
    return fetch("https://reactnative.dev/movies.json")
      .then(response => response.json())
      .then(responseJson => {
        this.setState({
          loading: false,
          dataSource: responseJson.movies
        });
      })
      .catch(error => console.log(error));
  }

  render() {
    const { loading, dataSource } = this.state;

    if (loading) {
      return (
        <View style={styles.container}>
          <ActivityIndicator size="large" color="#0c9" />
        </View>
      );
    }

    return dataSource.map((movie, index) => (
      <View key={movie.id} style={styles.item}>
        <Text>{movie.title}</Text>
      </View>
    ));
  }
}

You could also pull this out to a renderMovies method, which might help since you are trying to display these in a styled container.

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      loading: true,
      dataSource: []
    };
  }
  
  componentDidMount() {
    return fetch("https://reactnative.dev/movies.json")
      .then(response => response.json())
      .then(responseJson => {
        this.setState({
          loading: false,
          dataSource: responseJson.movies
        });
      })
      .catch(error => console.log(error));
  }

  renderMovies() {
    const { dataSource } = this.state;

    return dataSource.map((movie, index) => (
      <View key={movie.id} style={styles.item}>
        <Text>{movie.title}</Text>
      </View>
    ));
  }

  render() {
    const { loading } = this.state;

    if (loading) {
      return (
        <View style={styles.container}>
          <ActivityIndicator size="large" color="#0c9" />
        </View>
      );
    }

    return (
      <View style={styles.container}>
        {this.renderMovies()}
      </View>
    );
  }
}
Answer from sammyt on Stack Overflow
🌐
React Native
reactnative.dev › docs › network
Networking · React Native
February 20, 2026 - This behaviour can be overridden by setting android:usesCleartextTraffic in the app manifest file. The XMLHttpRequest API is built into React Native.
🌐
Medium
medium.com › @emre.deniz › react-native-making-api-calls-1d5ce5172245
React Native: Making API Calls. Overview | by Emre Deniz | Medium
November 25, 2024 - Developers send network queries to API endpoints throughout this phase, process the responses, and display the data in the user interface of the application. ... fetch("https://dummy.restapiexample.com/api/v1/employees") .then((response) => ...
Discussions

API integration with React Native
Use component did mount, use axios to create the http request, save the response JSON data to a variable, map the JSON array to a component with your fields. Here’s more on Axios: https://link.medium.com/KWnerFZnu0 More on reddit.com
🌐 r/reactnative
11
8
March 15, 2019
Connecting REST API in React Native
I am trying to learn how to connect APIs in React Native. More on stackoverflow.com
🌐 stackoverflow.com
Api authentication with credentials from a react-native app
Hi there, I have a react-native app and I’m using the react-native-auth0 SDK to login a user and get credentials when the login is successful. const onLogin = async (callback) => { try { await authorize().then(async () =>{ const credentials = await getCredentials(); await AsyncStorage.se... More on community.auth0.com
🌐 community.auth0.com
1
0
July 12, 2023
Can React Native feed data into other cloud software via API integration? Or is this complex and pushing the language's capabilities?
React Native can do (almost) everything native development can do, and integrating it with whatever API will be doable and on par in difficulty with any other tool/framework. More on reddit.com
🌐 r/reactnative
7
1
May 27, 2022
🌐
Instamobile
instamobile.io › blog › react-native-rest-api-integration
React Native REST API Integration: Fetch, Post, and Optimize with Axios | React Native App Templates & Themes
August 23, 2025 - A comprehensive guide to integrating REST APIs in React Native applications using Axios and Fetch, covering data fetching, error handling, and authentication.
🌐
Reddit
reddit.com › r/reactnative › api integration with react native
r/reactnative on Reddit: API integration with React Native
March 15, 2019 -

All I want to do is create a screen on React Native that will fetch an API POST request (body already hardcoded) and output the JSON response on the screen. Can anyone teach me how?

Top answer
1 of 4
9
Use component did mount, use axios to create the http request, save the response JSON data to a variable, map the JSON array to a component with your fields. Here’s more on Axios: https://link.medium.com/KWnerFZnu0
2 of 4
2
I made an expo snack for you to see how to do it: https://snack.expo.io/@nandorojo/carefree-pastry You can remove the comments if they make the code too hard to read. You can also replace the URL in line 16 with your url. Here's a stripped-down image to show how it's done too: https://imgur.com/a/B48VhBA Steps are: Initialize state by creating the networkData state variable, with its initial value set to null (try to find where that null is set). Run a side effect where you fetch network data, and then set the networkData state variable to the fetched data. Whenever you "set the state" in react, it re-renders the component with the updated data. You cannot, however, just edit the state variable directly and expect the component to re-render. You must use the setNetworkData function. Also, the second variable in the useEffect must be present to keep the effect from running on every re-render. By making it an empty array, it will only run when the component is initially mounted. If you want it to re-run every time some variable changes, just add that variable(s) to the array in the second argument. Render your output :) Note This code example is using react-hooks (not react class components). This is the new standard, but if you're looking at it like WTF, you might want to read this from React: https://reactjs.org/docs/hooks-intro.html Good luck :) Also, I just uploaded my new app made with react-native to the app store. It collects all the best memes from reddit/instagram in real-time and puts them on one feed. It's very dope, here's my shameless plug! https://apps.apple.com/us/app/memezy/id1470707941
🌐
LogRocket
blog.logrocket.com › home › using axios with react native to manage api requests
Using Axios with React Native to manage API requests - LogRocket Blog
June 4, 2024 - In this article, you will learn how to super charge your API requests using Axios in a React Native application.
🌐
Apix-Drive
apix-drive.com › main page › blog › other
React Native API Integration | ApiX-Drive
January 18, 2025 - Once the CLI is installed, you can create a new React Native project by executing `react-native init YourProjectName`. After the project setup is complete, navigate into your project directory. For seamless API integration within your app, consider using ApiX-Drive, a service that simplifies connecting various APIs without extensive coding.
Top answer
1 of 3
1

First, there is a small typo in your example. In your component's constructor you specify a loading state variable, but in your render function you're using isLoading. Second, you're not mapping over your data correctly. It just looks like you need to specify what aspects of each movie you care about in your render function. JSX can't handle displaying a full javascript object which is what <Text>{val}</Text> ends up being in your code. There are a few ways you can fix this. It's very common to just map over your results and display them directly.

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      loading: true,
      dataSource: []
    };
  }
  
  componentDidMount() {
    return fetch("https://reactnative.dev/movies.json")
      .then(response => response.json())
      .then(responseJson => {
        this.setState({
          loading: false,
          dataSource: responseJson.movies
        });
      })
      .catch(error => console.log(error));
  }

  render() {
    const { loading, dataSource } = this.state;

    if (loading) {
      return (
        <View style={styles.container}>
          <ActivityIndicator size="large" color="#0c9" />
        </View>
      );
    }

    return dataSource.map((movie, index) => (
      <View key={movie.id} style={styles.item}>
        <Text>{movie.title}</Text>
      </View>
    ));
  }
}

You could also pull this out to a renderMovies method, which might help since you are trying to display these in a styled container.

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      loading: true,
      dataSource: []
    };
  }
  
  componentDidMount() {
    return fetch("https://reactnative.dev/movies.json")
      .then(response => response.json())
      .then(responseJson => {
        this.setState({
          loading: false,
          dataSource: responseJson.movies
        });
      })
      .catch(error => console.log(error));
  }

  renderMovies() {
    const { dataSource } = this.state;

    return dataSource.map((movie, index) => (
      <View key={movie.id} style={styles.item}>
        <Text>{movie.title}</Text>
      </View>
    ));
  }

  render() {
    const { loading } = this.state;

    if (loading) {
      return (
        <View style={styles.container}>
          <ActivityIndicator size="large" color="#0c9" />
        </View>
      );
    }

    return (
      <View style={styles.container}>
        {this.renderMovies()}
      </View>
    );
  }
}
2 of 3
0

I have used Object.values() to restructure the object into an array

  componentDidMount() {
    return fetch("https://reactnative.dev/movies.json")
      .then((response) => response.json())
      .then((responseJson) => {
        this.setState({
          loading: false,
          dataSource: Object.values(responseJson.movies),       //changed this
        });
      })
      .catch((error) => console.log(error));
  }
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › react-native-networking-api-requests-using-fetchapi
React Native Networking – How To Perform API Requests In React Native using the FetchAPI
October 15, 2024 - An API GET request is a type of API request used to retrieve data from a server. The request is sent via a HTTP GET method and data is returned in the form of a JSON or XML object. Let’s make a GET request in our React Native app.
🌐
Scaler
scaler.com › home › topics › react-native › handling apis in react native
Handling APIs in React Native - Scaler Topics
July 11, 2023 - React Native provides built-in APIs, such as the fetch() method, for making network requests, but developers can also use third-party libraries, such as Axios or Fetch, for more advanced functionality.
🌐
React
react.dev › reference › react › apis
Built-in React APIs – React
In addition to Hooks and Components, the react package exports a few other APIs that are useful for defining components. This page lists all the remaining modern React APIs · Resources can be accessed by a component without having them as part of their state.
🌐
Gr4vy
docs.gr4vy.com › guides › payments › react-native › quick-start › key
Creating an API key for use with React Native - Gr4vy
curl -X GET https://api.example.gr4vy.app/transactions \ -H "authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIi..." Using an SDK is recommended. SDKs make the process of generating a token a lot easier and are available in many popular programming languages.
🌐
Auth0
community.auth0.com › get help
Api authentication with credentials from a react-native app - Auth0 Community
July 12, 2023 - Hi there, I have a react-native app and I’m using the react-native-auth0 SDK to login a user and get credentials when the login is successful. const onLogin = async (callback) => { try { await authorize().then(async () =>{ const credentials = await getCredentials(); await AsyncStorage.se...
🌐
AWS Amplify
docs.amplify.aws › gen1 › react-native › build-a-backend › restapi › set-up-rest-api
Set up Amplify REST API - React Native - AWS Amplify Gen 1 Documentation
April 29, 2024 - To start provisioning API resources in the backend, go to your project directory and execute the command: ... Upon completion, amplifyconfiguration.json should be updated to reference provisioned backend storage resources. Note that this file should already be a part of your project if you followed the Project setup walkthrough. Use the package manager of your choice to install the amplify JS library. For example, with npm: Instructions for React Native version 0.72 and below
🌐
GitHub
github.com › hasanaydins › reactNativeRestApi
GitHub - hasanaydins/reactNativeRestApi: React Native rest api calling example with search feature. · GitHub
React Native rest api calling example with search feature. - hasanaydins/reactNativeRestApi
Author   hasanaydins
🌐
Stackademic
blog.stackademic.com › exploring-react-native-api-calls-a77cd9bdcab5
Exploring React Native API Calls. React Native, a powerful framework for… | by Ömür Bilgili | Stackademic
January 11, 2024 - API calls serve as the bridge between a React Native app and a server, enabling the exchange of data. Whether fetching information, submitting form data, or interacting with third-party services, mastering API calls is fundamental for creating ...
🌐
CA Technologies
techdocs.broadcom.com › us › en › ca-enterprise-software › it-operations-management › app-experience-analytics-saas › SaaS › using › using-apis › React-Native-Custom-APIs.html
React Native Custom APIs
January 2, 2025 - This API call prevents any screen capture during the loadView call by overriding the policy for this invocation. ... If successful, completed = YES and errorString = an empty string. If there is a failure, completed = NO and errorString = an error message. The error message contains the error domain, a code, and a localized description. import Platform from react; if (Platform.OS == "ios") { var viewName = "my custom view";" var loadTime = 237; AXASDK.viewLoadedWithoutScreenCapture(viewName, loadTime, (completed, errorString) => { if (completed) { // everything is fine console.log(`***view load recorded (${completed}) ${errorString}`); } else { if (errorString) { // process error message console.log(`error recording view load: ${errorString}`) } } }) }