react-api-fetcher
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

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]
});

Package Sidebar

Install

npm i react-api-fetcher

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

13.8 kB

Total Files

13

Last publish

Collaborators

  • dzpt