2.0.0 • Published 5 years ago

@aniketgargya/axios-hooks v2.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

Axios Hooks for React

npm version

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 "@aniketgargya/axios-hooks";
// Called as soon as component is mounted
const { response, loading, error } = useAxios({
    url: "https://yourapi.com/path/data.json",
    method: "GET"
});

or

// Called when sendRequest() is called
const [sendRequest, { response, loading, error }] = useLazyAxios({
    url: "https://yourapi.com/path/data.json",
    method: "GET"
});

handleClick = () => {
    sendRequest();
}

To install:

npm install axios @aniketgargya/axios-hooks

Type definitions are provided!

2.0.0

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago