re: I used effects, said goodbye to my lifecycles, and feel 🙂 VIEW POST


Hey Thomas, great article!

You've got one thing wrong though. To remove an event listener you have to pass the same callback function you've passed when created it.
Using an anonymous function will not work here. return () => document.removeEventListener("keydown", () => {}); will do nothing.

Check those:


Hey Radu! Thanks for the feedback. To be honest, I was quite unaware of this, but thinking about it, it actually makes sense :)

I've updated the code! Thanks again :)

code of conduct - report abuse