Returns memoized version of the parameter function fn. The memoized
function will return cached value as long as the arguments of the call have
the same tracked values as the last time.
Memoized function has two cache levels:
A WeakMap by first object parameter
Global cache that only holds the last execution result.
// Even though the input objects are different the `cachedResult` is the // same since the tracked properties didn't change. // Prints `true`. console.log(answer === cachedAnswer);
Returns memoized version of the parameter function
fn
. The memoized function will return cached value as long as the arguments of the call have the same tracked values as the last time.Memoized function has two cache levels:
See
IMemoizeOptions for details on available options.
Returns
memoized function.
Example
With two parameters:
Example
With react-redux and an id lookup. (Taken from proxy-memoize.)