Hi Pablo,
yes the timer keeps runnig if we are not clearing it. As you see we are using the cleanup function in the useEffect hook to take care of it
useEffect
return () => clearInterval(interval);
The moment you call the clearInterval(interval); with the respective intervalID you can control the timer. So you can call it based on your use cases.
clearInterval(interval);
Thanks for giving it a read and commenting.
NIce, thanks a lot!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Pablo,
yes the timer keeps runnig if we are not clearing it. As you see we are using the cleanup function in the
useEffect
hook to take care of itThe moment you call the
clearInterval(interval);
with the respective intervalID you can control the timer. So you can call it based on your use cases.Thanks for giving it a read and commenting.
NIce, thanks a lot!