https://github.com/devnax/with-memoize
https://github.com/devnax/with-memoize
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/devnax/with-memoize
- Owner: devnax
- License: mit
- Created: 2022-07-27T14:38:53.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-27T14:40:00.000Z (almost 4 years ago)
- Last Synced: 2025-01-22T00:41:25.344Z (over 1 year ago)
- Language: TypeScript
- Size: 121 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### 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
```js
import { FC } from "react";
import withMemo from "with-memoize";
const Example: FC<{count: number }> = ({ count }) => (
{count}
);
export default withMemo(Example, (props) => {
// do somthing
return [props.count]
});
```