🍾 Axios Hooks Usage Example
- 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>
)
}