1.0.0 • Published 3 years ago
with-memoize v1.0.0
API documentation
The with-memoize is a simple wrapper for cache a component.
that cache the most recent result. However, this cache can be destroyed by React when it wants to
The with-memoize function accepts the properties Component and callback the callback is optional. If you don't give the callback then dependancy will be props values
yarn add with-memoize
# or
npm install with-memoize --saveUsage
import { FC } from "react";
import withMemo from "with-memoize";
const Example: FC<{count: number }> = ({ count }) => (
<div>{count}</div>
);
export default withMemo(Example, (props) => {
// do somthing
return [props.count]
});1.0.0
3 years ago