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

123
Visualizações
What is more prefered way of updating data in child components hooks or redux?

i am new to JS. And I wondered what is more prefered way for updating data in children components. Is that better to use hooks or redux? Let say i have a parent component with 3 child components.

<Parent> 
  <ChildA/>
  <ChildB/>
  <ChildC/>
</Parent>

And i have a need to update something in ChildA and ChildB and pass it to ChildC

What would the best way to do it ?

Shall i use hooks like this?

[childAValue, setChildAValue] = useState([])
[childBValue, setChildBValue] = useState([])

  <ChildA onChildChanged={(e) => {
    setChildAValue(e)
    }}
  />
  <ChildB onChildChanged={(e) => {
    setChildBValue(e)
    }}
  />
  <ChildC childAValue={childAValue} setChildBValue={setChildBValue} />

Or it's better to use redux ? Because with using hooks i may have a lot of rerendering if there are 3-4 components or more. But on the other hand Redux will be just overloaded if i will use it for every possible component Which way do you prefer more and why? This question also refears to modals also when you need to pass value from modals to suibling component/s.

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

0

here you have multiple child components, you need to pass down functions to change them in all of them, redux can be used here and it will remove the hassle pass down props to each of the components. Redux is industry standard and is being used in large web projects, where you need to manage a global state to be present and accessible in all of the components/modules, for example Authentication state, for your question simply passing down as props also works so there is no need to complicate things further.

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