DEV Community

Discussion on: Handle keyboard event with React Hooks

Collapse
 
dance2die profile image
Sung M. Kim

As the event handler is bound to the window, even after the component is unmounted, the handler is still active.

As a general rule, cleaning up when unused would save memory and other possible issues.