2.2.1 • Published 4 years ago

react-axios-hooks v2.2.1

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

React Axios Hooks

npm version Build Status

This npm package includes a hook for fetching data with axios. You can use it with the exact same configurations as axios.

To import:

import { useAxios, useLazyAxios } from "react-axios-hooks";
// Request sent as soon as component is mounted
const { response, loading, error } = useAxios({
    url: "https://yourapi.com/path/data.json",
    method: "GET"
});

or

// Request sent when sendRequest() is called
const [sendRequest, { response, loading, error }] = useLazyAxios();

const handleClick = () => {
    sendRequest({
        url: "https://yourapi.com/path/data.json",
        method: "GET"
    });
};

To install:

npm install axios react-axios-hooks

Type definitions are provided!

2.2.1

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.4

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago