memo-deps
v1.1.2
Published
Memo with Dependencies, same API as React.useMemo
Downloads
6,218
Readme
memo-deps
Memo with Dependencies. Inspired from React.useMemo. This can be used outside of React components without hooks.
Usage
import { memo } from 'memo-deps';
function expensive(arg1, arg2) {
//
}
const memoized = memo(expensive);
const dep1 = { a: 1 };
const dep2 = [ 4 ];
let result1 = memoized([arg1, arg2], [dep1, dep2]);
let result2 = memoized([arg3, arg4], [dep1, dep2]);
result1 === result2 // true