4 ms·
How is the setInterval cleared when Counter is no longer rendered? It seems like a leak.
by continuational 5y ago
How is the setInterval cleared when Counter is no longer rendered? It seems like a leak.
- bgirard 5y agoIt's certainly a leak. That setInterval is going to be holding the closure context alive which will reference the component in many frameworks. The setInterval will also keep firing causing, wasting CPU and battery. It's hard to take any examples here seriously without showing proper cleanup that would pass code review.
- sanitycheck 5y agoGood to see other people spotted that, I noticed it immediately and had a "there's a bug! a bug!" alarm bell ringing in my head throughout the rest of the article. I may have some sort of setInterval related PTSD.