react-async-usefetch
v1.0.6
Published
Simple useFetch hook
Downloads
9
Maintainers
Readme
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