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

138
Visualizações
Is there any better solution then passing prop up to the parent component?

I am in situation that I need to use state from one component as a dependency value in another's componet useEffect hook. Easy illustration of this situation is in attached image.

enter image description here

I know that I can pass state from first component up to the parent component, in this case the App component, and then the state from parent component (App) pass down to the second component as a prop. But is there any better solution?

Thank you for your help.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

you could either lift the state up to the parent component using a func for example and pass it down to component2, or use a state management library, depending on the scale of your app, smaller - medium scale I would use React context-API or redux since its widely used and easy to master

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