react-async-usefetch
Version:
Simple useFetch hook
40 lines (20 loc) • 617 B
Markdown
# react-async-usefetch
## Purpose
Simple useFetch Hook.
## Installation
`npm i react-async-usefetch`
or
`yarn add react-async-usefetch`
## Usage
```js
import usefetch from 'react-async-usefetch';
const { dataResponse, dataError, isDataLoading} = useFetch({ url, options, delay, returnDict: ["dataResponse", "dataError", "isDataLoading"]});
console.log("dataResponse: ", dataResponse);
console.log("dataError: ", dataError);
console.log("isDataLoading: ", isDataLoading);
```
### Default function and return dict.
```js
response: ["response", "error", "isLoading"]
fetch function: window.fetch
```