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

214
Views
componentDidUpdate() reference checknig as a correct react-redux design check

If I find that my componentDidUpdate(prevProps, prevState) is being run lots of times with same props and state values but different references, is this a sign of bad design?

componentDidUpdate(prevProps, prevState) {
    console.log('isPropsReferenceEqual: ', prevProps === this.props); // false
    console.log('isStateReferenceEqual: ', prevState === this.state); // false
    console.log('isPropsValueEqual: ', JSON.stringify(prevProps) === JSON.stringify(this.props)); // true
    console.log('isStateValueEqual: ', JSON.stringify(prevState) === JSON.stringify(this.state)); // true
}

It could be prevented adding the value equality check in shouldComponentUpdate(nextProps) but that is not the question. The question is that considered componentDidUpdate() triggers for either prop or state change, if this state or prop change is a ref change with same values is due to bad design and programmers fault and should have been prevented before in the state management e.g before dispatching the action or checking in the reducer that will update the state cheking value equality.

about 4 years ago · Juan Pablo Isaza
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!