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).
npm i react-default-memo
yarn add react-default-memo
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
).
MIT