use-window-event
Adds event listener to the window object on component mount and removes the event when the component unmounts
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
The hook has the same definition as window.addEventListener function: