https://github.com/slikts/react-default-memo
📝 Proof of concept for deeply memoizing React components by default
https://github.com/slikts/react-default-memo
memoization react value-semantics
Last synced: 3 months ago
JSON representation
📝 Proof of concept for deeply memoizing React components by default
- Host: GitHub
- URL: https://github.com/slikts/react-default-memo
- Owner: slikts
- License: mit
- Created: 2020-02-23T23:43:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-03T19:08:58.000Z (over 4 years ago)
- Last Synced: 2025-10-04T07:54:09.426Z (7 months ago)
- Topics: memoization, react, value-semantics
- Language: JavaScript
- Homepage:
- Size: 2.85 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
react-default-memo
This is a proof of concept for "memoizing" React components by default and in a more comprehensive way than is possible either with React builtins like `memo()` or `useMemo()`, or with libraries like [use-deep-compare-effect] and [react-fast-compare].
**[Demo][demo]** (CodeSandbox).
## Installation
```sh
npm i react-default-memo
```
```sh
yarn add react-default-memo
```
## Usage
Add at the top of a file:
```js
/** @jsx createValueElement */
import { createValueElement } from "react-default-memo";
```
This replaces the React builtin `createElement()` with a custom `createValueElement()` function using the `@babel/plugin-transform-react-jsx` plugin (included by default in tools like `create-react-app`).
## License
MIT
[use-deep-compare-effect]: https://github.com/kentcdodds/use-deep-compare-effect
[react-fast-compare]: https://github.com/FormidableLabs/react-fast-compare
[tuplerone]: https://github.com/slikts/tuplerone
[demo]: https://codesandbox.io/s/react-default-memo-demo-y3kp7