Axios Get Request in React Native Example




Axios Get Request in React Native Example

Hi Dev,

In this tutorial, I will learn you how to get request using axios in react native we can show instance of react native axios https placed request,You could easliy use react native axios get response.In this case import stylesheet namespace from axios and react-native-paper. React native affords the axios placed API for your networking wishes. axios get will appear familiar when you have used XMLHttpRequest or different networking APIs earlier than. you could discuss with MDN's manual on using axios get for additional data.

Here, i can give you complete example for definitely react native axios https get request as bellow.

Step 1 - Create project

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

expo init NicesnippetsApp

Step 2 - Install Package

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

yarn add react-native-paper

After,I will install npm i yarn add axios.

yarn add axios

Step 3 - App.js

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

import React, { Component } from "react";

import { Text, View,StyleSheet} from 'react-native';

import { Provider ,Appbar,Card,IconButton,Avatar} from 'react-native-paper';

import axios from 'axios';

const NicesnippetsComponent = () => {

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

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

React.useEffect(() => {


.then((json) => setData(

.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" />

<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,



backgroundColor: '#e2e2e2',



export default NicesnippetsComponent;

Step 4 - Run project

In the last step run your project using bellow command.

npm start


It will help you...

#React Native