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

114
Vistas
How to stop re-rendering of child component when its parent's props change?

I have a Modal that is a child of a Card component:

Card > Modal

The Card has props that it sends down to the Modal. When I select an option in the Modal's UI, it updates the data in the Card and, thus, re-renders the Card, closing the Modal as it does so.

This is not ideal because I would like the user to continue to use the Modal until they explicitly hit "close".

Is there a way to update the data/state in the underlying Card (so that the Modal can use the new state), but NOT trigger a full re-render of the component tree until the Modal is finally closed?

There is no Redux involved right now, and I'd like to avoid it if possible.

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

0

Whenever a state is updated, all components that use the state and its children are re-rendered. You should probably use react portals to achieve what you need with the modal. There is a fiddle on the end of the docs link. Docs: https://reactjs.org/docs/portals.html

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