
React Hooks Design Review
Software Unscripted
00:00
How to Clean Up Event Listeners in JavaScript
I can see an argument for forgetting to clean up event listeners is error prone or can be. So you want to ideally sort of abstract out of way and I guess that's what use like the hook kind of does is gives you both the here it is and then also here's the cleanup for it. But if I'm thinking about this, right? It feels like there's some way to do this with like prototypes maybe or some sort of class based thing. Maybe not. Oh, you mean like extending other components, maybe like creating some kind of inheritance. I'm just talking about plain old JavaScript inheritance.
Transcript
Play full episode