Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@cyca/simple-create-resource

cvpcasada16MIT0.1.0TypeScript support: included

Super basic create-resource for use with React Suspense with basic global cache. Note that this doesn't respect HTTP Caching.

readme

@cyca/simple-create-resource

Super basic create-resource for use with React Suspense with basic global cache. Note that this doesn't respect HTTP Caching.

This project was bootstrapped with TSDX.


Usage:

// resources.js
import { createResource } from "@cyca/simple-create-resource";

const API = createResource(url => (
  fetch(url).then(res => res.json())
);

const FirebaseDoc = createResource(path => (
  firebase.firestore().doc(path).get()
))

export { API, FirebaseDoc }
// somefile.js
import { API } from './resources';

API.preload('/thing');
const stuff = API.read('/thing');
API.clear('/thing');
API.clear(); // all keys