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

206
Vistas
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
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