Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.94 KB

File metadata and controls

44 lines (31 loc) · 1.94 KB

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 (CodeSandbox).

Installation

npm i react-default-memo
yarn add react-default-memo

Usage

Add at the top of a file:

/** @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