Sometimes when the user goes to the next screen I trigger a new Timer with others parameters (including the departure time, to display a countdown in notifications) .
In this situation, the first countdown does not have time to stop and both tasks continue to run
I created a simplified example to show my problem.
In this situation, I don't understand why two timers are running in the background:
Hello and sorry for my bad english, I'm french :)
Thanks you very much for your library. :)
I created a
Timer
module, which triggers a countdown. I want this Timer to stop when leaving the screen. I put my code in a useEffect :Sometimes when the user goes to the next screen I trigger a new
Timer
with others parameters (including the departure time, to display a countdown in notifications) . In this situation, the first countdown does not have time to stop and both tasks continue to runI created a simplified example to show my problem.
In this situation, I don't understand why two timers are running in the background: