Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!