Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 1.18 KB

README.md

File metadata and controls

44 lines (34 loc) · 1.18 KB

next-memo

Memoize for next.

version license size download

installation

npm install -S @jswork/next-memo

usage

import '@jswork/next-memo';

const fibonacci = (n) => {
  return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
};
const memoized = nx.memoize(
  fibonacci
);

// First time: calc
const rs1 = memoized(number);
// Next time: From Cache
const rs2 = memoized(number);

license

Code released under the MIT license.