micro-memoize
memoize-one
micro-memoize | memoize-one | |
---|---|---|
1 | 2 | |
229 | 2,912 | |
- | - | |
4.3 | 0.0 | |
about 2 months ago | over 1 year ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
micro-memoize
-
What is the best memoization library?
The author has also published a bare-bones version called micro-memoize. If you care about bundle size and don't need any bells and whistles, this is likely your best bet. If you do end up going that route, watch out for the default maxSize of 1, meaning unless you specify otherwise, it will only store the most recent result in the cache.
memoize-one
-
Improving Render Performance in React
Another option is to memoize (not memorize) the results of the process. Memoization is a form of in-memory caching. We're only going to discuss this in the context of functional components where we can use the useMemo hook provided by React, but you may be able to achieve similar results in a class component using a third-party helper.
-
Techniques to optimize React render performance: part 2
Caching computed values in class components is a bit clunkier, especially if you are trying to avoid the UNSAFE_componentWillReceiveProps() lifecycle function. The React maintainers recommend using the memoize-one library:
What are some alternatives?
just - A library of dependency-free JavaScript utilities that do just one thing.
use-deep-compare-effect - 🐋 It's react's useEffect hook, except using deep comparison on the inputs, not reference equality
moize - The consistently-fast, complete memoization solution for JS
marked - A markdown parser and compiler. Built for speed.
DOMPurify - DOMPurify - a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. DOMPurify works with a secure default, but offers a lot of configurability and hooks. Demo:
solid - A declarative, efficient, and flexible JavaScript library for building user interfaces. [Moved to: https://github.com/solidui/solid]
react-virtualized - React components for efficiently rendering large lists and tabular data
react-window - React components for efficiently rendering large lists and tabular data