An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

react-default-memo


npm
npm (tag)
Release
Coveralls
semantic-release
Dependabot

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