A lightweight wrapper around Reselect that provides deeper memoization and cache management for selectors. Current stable version is 5.1.0. Since Reselect v5, many re-reselect features are now native in Reselect, but re-reselect continues to offer backward compatibility and custom caching strategies. It maintains a cache of Reselect selectors keyed by a user-defined key selector, allowing different calls with different arguments to hit separate caches. Compared to bare Reselect, re-reselect prevents cache invalidation when switching between different argument values, making it ideal for sharing selectors across multiple component instances or sequentially calling selectors with varying parameters.
npm install re-reselectNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates createCachedSelector with a keySelector based on libraryName, showing cache retention across different argument values.
yarn add reselect@^5.0.0 or npm install reselect@^5.0.0
Consider switching to native reselect createSelector with custom memoize options if you don't need backward compatibility.
Ensure keySelector returns a primitive (string, number) or a value compatible with the chosen cache object.
Pass { cacheObject: new LruCacheObject({ maxSize: 5 }) } as option to restore LRU behavior.Cast keySelector return type explicitly or use type assertions with caution.
Use named import: import { createCachedSelector } from 're-reselect';Install reselect and its types if using TypeScript: npm install reselect @types/reselect re-reselect
Install reselect: npm install reselect
Pass a keySelector function that returns a primitive (e.g., (state, arg) => arg.id).