JSPM

@guoyunhe/react-fetch

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q10390F
  • License MIT

Fetch and cache remote data in React apps

Package Exports

  • @guoyunhe/react-fetch
  • @guoyunhe/react-fetch/dist/index.js
  • @guoyunhe/react-fetch/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@guoyunhe/react-fetch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-fetch

Fetch and cache remote data in React apps.

HTTP client adaptors:

  • fetch API
  • axios

Browser cache adaptors:

  • Memory (a Map object, not persist)
  • IndexedDB (persist, almost no limit in size)

Why not localStorage?

  • Both of them have 5MB size limit and can be easily filled up. Once the storage is full, any write access will throw errors and may break other functionalities that depend on localStorage.
  • It is hard, if possible, to isolate cache from other important data, like auth tokens. Make cleaning and invalidating caches hard.

Install

npm i @guoyunhe/react-fetch

Usage

import { hello } from '@guoyunhe/react-fetch';

hello('world');