Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

182
Vistas
Why does the following use of useSelector break referential equality?

I was having an issue where selecting certain values out of my store would trigger a rerender with any store value update, even if I was selecting values that weren't updating. It turns out, the issue was that I was doing this:

const transformedValues = useSelector(state => state.some.array).map(value => value);

As the answer to the above referenced question points out, this breaks referential equality of transformedValues, causing the component to update.

But when I do this, there is no issue, and no unecessary rerender:

const valuesFromStore = useSelector(state => state.some.array);
const transformedValues = valuesFromStore.map(value => value);

Why? What is the difference in these two tactics that in the first one, referential equality of the selector is broken (causing rerender), and in the second, it does not cause a rerender? What is going on "under the hood" of redux and javascript to make a difference here?

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda