slikts / react-default-memo

πŸ“ Proof of concept for deeply memoizing React components by default

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

πŸ“ Proof of concept for deeply memoizing React components by default

License:MIT License


Languages

Language:JavaScript 100.0%