Skip to content

Reselect

A library for creating memoized selector functions that derive data from state, mainly for Redux.

Stars
19k
Forks
666
Licence
MIT
Language
TypeScript
Last update
9 days ago
Type
Library

What it is

Reselect helps you write functions that pull or compute data from an app's state. It remembers the last result and only recalculates when the inputs change, which avoids repeated work. It is commonly used with Redux, though the README says it works with any plain JavaScript immutable data.

  • Filtering a list of todos to show only completed items without recalculating on unrelated state changes
  • Combining several input selectors into one derived value, such as a count of unread alerts
  • Building structured selectors that return several derived values at once with createStructuredSelector

Great for

  • Redux users who want to derive data from a minimal store without recomputing it on every render
  • Developers using React-Redux who need stable result references to avoid unnecessary UI updates
  • TypeScript projects that want typed, composable selectors

Not ideal for

  • People who are not using Redux or immutable-style data, since the main benefit depends on unchanged inputs
  • Beginners new to Redux, who may find the memoization concepts hard to grasp without learning the Redux basics first
Step-by-step guide: how to use ReselectInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js · npm, yarn, or pnpm

    Install with npm

    npm install reselect

    Install with Yarn

    yarn add reselect

    Install with pnpm

    pnpm add reselect
  2. 2

    Run it

    • Install the reselect package, or import createSelector from @reduxjs/toolkit if you already use Redux Toolkit
    • Import createSelector from 'reselect'
    • Define one or more input selectors that read from your state
    • Pass the input selectors and a result function to createSelector and call the returned selector
  3. 3

    Get the most out of it

    • Use the official docs at reselect.js.org for the API reference on createSelector, createSelectorCreator, and createStructuredSelector
    • Enable development-only checks such as inputStabilityCheck and identityFunctionCheck to catch selector mistakes, as described in the v5.0.0 notes
    • Read the Redux docs page on deriving data with selectors for usage patterns and React-Redux guidance
    • Use createSelectorCreator with custom memoize or argsMemoize options if the default caching does not fit your needs

Downloads

Strengths

  • Selectors skip recalculation when their arguments have not changed, according to the README
  • Returns the same result reference when nothing changed, which helps React-based UI updates
  • Composable: selectors can be used as inputs to other selectors

Trade-offs

  • Only useful when the data it wraps is treated as immutable; mutated state will not be detected
  • Requires understanding memoization and selector composition, which adds conceptual overhead
  • The README is truncated here, so version compatibility details beyond the v5 notes are not covered

How it compares

ProjectStarsTypeLevelUpdatedBest for
reselect (this)19kLibraryintermediate9 days agoRedux users who want to derive data from a minimal store without recomputing it on every render
redux-toolkit11.2kLibraryintermediate4 days agoDevelopers already using or learning Redux for app state
redux61.4kLibraryintermediate17 days agoDevelopers building larger front-end apps where many components share the same data
zustand58.9kLibrarybeginner15 days agoReact developers who want simpler shared state than Redux
immer29kLibrarybeginner6 days agoJavaScript developers who find hand-written immutable updates verbose or error-prone
redux-saga22.4kLibraryintermediate12 days agoReact or other frontend developers already using Redux who need to manage async logic

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.