react-api-fetcher
v1.0.5
Published
react api fetcher using hook js native retry loading timeout
Downloads
11
Readme
React API Fetcher
Simple react api fetcher written in Typescript
Install
npm i react-api-fetcher
Features
- Support hook
- React JS/Native support
- Trigger update by dependencies
- Support connection timeout
- Support retry
- isLoading flag
Getting started
unmanaged state
import { request } from "react-api-fetcher";
request(
"https://get.geojs.io/v1/ip/country.json",
jsonData => {},
error => {}
);
managed state
import { useFetch } from "react-api-fetcher";
const { data, isLoading, error, retry } = useFetch({
url: "https://get.geojs.io/v1/ip/country.json",
onUpdate: [pageDep]
});