DEV Community

Discussion on: How to Force Re-Render a React Component & Should you do it?

Collapse
manvi profile image
Nikita Makarov

Hello!
You should replace
clearInterval(intervalId) with
() => clearInterval(intervalId),
in your case the interval will clear immediately.

Collapse
ruppysuppy profile image
Tapajyoti Bose Author

Yeah, thanks a lot for pointing it out! A rather silly mistake on my part