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

324
Vistas
React.PureComponent - Why is this not implemented in React by default?

I have read about the differences between the Component and PureComponent classes of React and understood that PureComponent does the shallow comparisons of props and state in order to efficiently manage the renderings. Here are few questions,

  1. If the PureComponent optimizes renderings by avoiding unnecessary re-renders, Why doesn't it come By Default in the React (may be by implementing the handling of shouldComponentUpdate() in the Component class itself as React is all about efficiently updating the DOM).

  2. When do someone want to re-render a page even when the props and state remains unchanged, i.e. when to use Component over PureComponent?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Because doing the shallow props and state diff is not free, it requires a (tiny amount of) work. Since React already diffs with the DOM and only changes what you've changed in your re-rendered version (if anything), it's already doing one diff. Doing two (diffing the props and state, and then diffing w/the DOM) is sometimes useful (if they're unlikely to have changed), sometimes not (if they're very likely to have changed). So you can use PureComponent (or implement shouldComponentUpdate) if you think it will be useful, and not if you don't.

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