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

79
Visualizações
Redux state change from one component not triggering useEffect in another component

This is first time I am using ReduxJS.

I have two components one parent and one child.

In child

dispatch(someAction(payload))

In Parent


let some = useSelector((state)=> state.a)


useEffect(()=>{

//some code//

},[some])


Expected:

As per my knowledge I dispacthed a action from child that will change the redux state. Now In parent "some" should get updated too and it should trigger useEffect.

What-is-actually-happening:

useEffect Does not get triggered.

Can somebody please point out what I am doing wrong here?

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

0

can you please confirm 2 things:

  1. does the dispatch carry correct payload and it gets completed.
  2. if the redux state is updated with the value that was dispatched. both of these things can be checked via Redux dev tools.

I hope your problem is related to of the two points mentioned above and yes the useEffect() should run.

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