Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsJul 28, 2026·3 min de lectura

Reselect — Memoized Selector Library for Redux

A library for creating memoized selector functions for Redux stores. Reselect computes derived data efficiently, preventing unnecessary re-renders and keeping component logic clean.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Reselect
Comando de instalación directa
npx -y tokrepo@latest install 57ebc89a-8aa2-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

Reselect is the official selector library for Redux that creates memoized, composable selector functions. It prevents expensive recomputation by caching results and only recalculating when relevant inputs change, which directly reduces unnecessary React re-renders.

What Reselect Does

  • Creates memoized selectors that cache their output based on input equality
  • Composes selectors from other selectors for clean derived-data pipelines
  • Integrates seamlessly with Redux and React-Redux via useSelector
  • Supports custom memoization functions and equality checks
  • Provides createStructuredSelector for mapping multiple selectors to props

Architecture Overview

Reselect selectors are pure functions composed in a dependency graph. Each selector receives one or more input selectors and a result function. The library compares current inputs to previous inputs using reference equality by default; if nothing changed, it returns the cached result. This cascading memoization means deep selector chains only recompute the parts whose dependencies actually changed.

Self-Hosting & Configuration

  • Install from npm: npm install reselect
  • Import createSelector and define input selectors pointing at state slices
  • Chain selectors by passing one selector's output as another's input
  • Use createSelectorCreator to swap in custom memoization (e.g., deep equality)
  • Pair with Redux Toolkit's createSlice for a modern Redux setup

Key Features

  • Default reference-equality memoization with zero config
  • Composable selector chains for complex derived data
  • Pluggable memoization via createSelectorCreator
  • TypeScript support with strong type inference
  • Tiny footprint with no external dependencies

Comparison with Similar Tools

  • Redux Toolkit (createSelector) — Re-exports Reselect; identical API, bundled with RTK
  • Zustand — Built-in selectors with shallow compare; no separate library needed
  • MobX — Uses reactive computed values instead of manual selectors
  • Jotai — Atom-based derived state; different paradigm from selector composition

FAQ

Q: Is Reselect still needed with Redux Toolkit? A: Redux Toolkit includes Reselect as a dependency and re-exports createSelector, so you get Reselect automatically when using RTK.

Q: How do I handle selectors that depend on component props? A: Pass a factory function to useMemo that creates a per-instance selector, or use Reselect's createSelector with explicit argument selectors.

Q: Can Reselect memoize across multiple arguments? A: Yes. Each input selector can extract a different argument. The result function receives all extracted values and the output is memoized based on all of them.

Q: Does Reselect work outside Redux? A: Yes. Reselect is a general-purpose memoized-selector library. It works with any state container or plain objects.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados