Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Latest commit

 

History

History
40 lines (30 loc) · 1.09 KB

File metadata and controls

40 lines (30 loc) · 1.09 KB

React Native Typescript Boilerplate

React Native Typescript Boilerplate

🍾 Axios Hooks Usage Example

Features

  • All the axios awesomeness you are familiar with
  • Zero configuration, but configurable if needed
import useAxios from 'axios-hooks';
import { View , Text, TouchableOpacity } from "react-native";

function App() {
  const [{ data, loading, error }, refetch] = useAxios(
    'https://reqres.in/api/users?delay=1'
  )

  if (loading) return <Text>Loading...</Text>
  if (error) return <Text>Error!</Text>

  return (
    <View>
      <TouchableOpacity onPress={refetch}>refetch</TouchableOpacity>
      <Text>{JSON.stringify(data, null, 2)}</Text>
    </View>
  )
}

Documentation

API