useEventListener
API
import useEventListener from '@restart/hooks/useEventListener'
useEventListener
<T, K>(eventTarget: T | () => T, event: K, listener: EventHandler<T, K>, capture: boolean | AddEventListenerOptions) => voidAttaches an event handler outside directly to specified DOM element bypassing the react synthetic event system.
Parameters
eventTarget
T | () => Tevent
KThe DOM event name
listener
(this: T, ev: DocumentEventMap[K]) => anycapture
boolean | AddEventListenerOptionsWhether or not to listen during the capture event phase
Return Value void