Skip to content

aldrinpvincent/memoize-promise-fn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

memoize-promise-fn

A utility to cache api calls in JavaScript by memoizing promises.

https://hackernoon.com/cache-api-calls-in-javascript-by-memoizing-promises

Installation

npm install --save memoize-promise-fn
yarn add memoize-promise-fn

Usage

import memoizePromiseFn from 'memoize-promise-fn';

let cachedFetchData = memoizePromiseFn(fetchData);

Demo

Codesandbox - https://codesandbox.io/s/memoize-promise-fn-demo-468rks?file=/src/lib/index.js

Deployed in Vercel - https://memoize-promise-fn.vercel.app/