Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda