Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!