use-window-event
Adds event listener to window on component mount and removes it on unmount
Import
Source
Docs
Package
Usage
use-window-event adds event listener to window object on component mount and removes it on unmount:
Example
Search focus with ⌘ + K on mac or Ctrl + K on windows and linux on Mantine docs website:
Definition
Hook has exact same definition as window.addEventListener function: