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

168
Visualizações
React: how to monitor the focus state of another component

I have 2 separate components that are very "far" from each other (no parent-child relationship to pass props around):

  1. A component that does a count-down and navigates away when timer is hit.
  2. A text field down below the page.

I want to stop the timer when the user is editing the text field.

Besides saving an "isEditing" state into Redux or window (or some state management) from component #2, and monitoring that state from component #1, are there any standard React way to achieve this?

Perhaps there is a way for a ref to listen to another ref's property change, such as focus?

about 4 years ago · Juan Pablo Isaza
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