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

175
Visualizações
How to render an alert component in isolation?

I have a global alert component that uses an alert context to show and hide itself when its isActive state is updated. I use it throughout my components in various places. I'm building a modal component that uses the alert component for displaying errors in the modal. The issue I'm running into is when an alert is triggered in the modal, it also appears in a component outside the modal window that uses the alert. What is the best way to handle this so the alert component is only shown in the context in which it was called?

Thank you

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

0

To me this sounds like there should be two different contexts, not only one.

I think the purpose of the alert component being global will be that it should handle all errors.

If the modal should handle it's own errors, then they probably should be in its own context.

If you want to re-use parts of the same code, you can still do that with component composition.

If there is some logic that should handle all errors (e.g. a global logger), that could be a separate component, which is independent of the display. (A third context is probably not needed, as the logging will have its own kind of storage.)

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