npm.io
1.0.6 • Published 5 years ago

react-async-usefetch

Licence
MIT
Version
1.0.6
Deps
0
Size
4 kB
Vulns
0
Weekly
0

react-async-usefetch

Purpose

Simple useFetch Hook.

Installation

npm i react-async-usefetch

or

yarn add react-async-usefetch

Usage


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.

response: ["response", "error", "isLoading"]

fetch function: window.fetch

Keywords