with-memoize
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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 --save

Usage

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]
});

Readme

Keywords

Package Sidebar

Install

npm i with-memoize

Weekly Downloads

6

Version

1.0.0

License

MIT

Unpacked Size

8.27 kB

Total Files

12

Last publish

Collaborators

  • devnax