React Native Fetch Http Get Request Example

Published By: Admin, Published On: May 11, 2021, Category: React Native
Hi Guys, Today, I will learn you how to use fetch https get request in react native. We will show example of react native fetch https get request, you can easliy use react native fetch get response. In this example import stylesheet namespace from react-native-paper. React Native provides the fetch get API for your networking needs. fetch get will seem familiar if you have used XMLHttpRequest or other networking APIs before. You may refer to MDN's guide on Using fetch get for additional information. Here, I will give you full example for simply react native fetch https get request as bellow. Step 1 - Create project

In the first step Run the following command for create project.

expo init MywebtutsApp 
Step 2 - Install Package

In the step,I will install npm i react-native-paper package.

npm i react-native-paper
Step 3 - App.js

In this step, You will open App.js file and put the code.

import React, { Component } from "react";
import { Text, View,StyleSheet} from 'react-native';
import { Provider ,Appbar,Card,IconButton,Avatar} from 'react-native-paper';

const MyWebtutsComponent = () => {

  const [data, setData] = React.useState([]);
    const [isLoading, setLoading] = React.useState(true);

   React.useEffect(() => {
      .then((response) => response.json())
      .then((json) => setData(
      .catch((error) => console.error(error))
      .finally(() => setLoading(false));
  }, []);

  const _goBack = () => console.log('Went back');

  const _handleSearch = () => console.log('Searching');

  const _handleMore = () => console.log('Shown more');

  return (
    <Appbar.Header style={styles.header}>
      <Appbar.BackAction onPress={_goBack} />
      <Appbar.Content title="User" subtitle="Subtitle" />
      <Appbar.Action icon="magnify" onPress={_handleSearch} />
      <Appbar.Action icon="dots-vertical" onPress={_handleMore} />
      <View style={styles.mainbox}>
  , i) => (
            <Card key={i} >
                title= {l.first_name}
                left={(props) =>   <Avatar.Image size={50} source={{ uri: l.avatar }} />}
                right={(props) => <IconButton {...props} icon="more" onPress={() => {}} />}

const styles = StyleSheet.create({
    margin: 10,
    fontSize: 15,
    fontSize: 35
    margin: 15,
    flex: 1,
    justifyContent: 'space-between',
    margin: 10,
export default MyWebtutsComponent;
Step 4 - Run project

In the last step run your project using bellow command.

npm start

It will help you...