memoize a function based its arguments passed, potentially improving runtime performance
import moize from 'moize';// standard implementationconst fn = (foo, bar) => `${foo} ${bar}`;const memoizedFn = moize(fn);// implementation with optionsconst fn = async (id) => get(`http://foo.com/${id}`);const memoizedFn = moize(fn, {isPromise: true, maxSize: 5});// implementation with convenience methodsconst Foo = ({foo}) => <div>{foo}</div>;const MemoizedFoo = moize.react(Foo); Copy
import moize from 'moize';// standard implementationconst fn = (foo, bar) => `${foo} ${bar}`;const memoizedFn = moize(fn);// implementation with optionsconst fn = async (id) => get(`http://foo.com/${id}`);const memoizedFn = moize(fn, {isPromise: true, maxSize: 5});// implementation with convenience methodsconst Foo = ({foo}) => <div>{foo}</div>;const MemoizedFoo = moize.react(Foo);
the function to memoized, or a list of options when currying
the options to apply
the memoized function
Generated using TypeDoc
Description
memoize a function based its arguments passed, potentially improving runtime performance
Example
Param
the function to memoized, or a list of options when currying
Param
the options to apply
Returns
the memoized function