Function useEventListener
- useEventListener<EventName, Event, Target>(__namedParameters): void
-
Type Parameters
-
EventName extends string | number | symbol
-
Event
-
Target extends Window | HTMLElement | MediaQueryList = Window
Parameters
-
__namedParameters: {
active?: boolean;
eventName: EventName;
listener: ((event) => void);
passive?: boolean;
target?: Target;
}
-
Optional
active?: boolean
-
eventName: EventName
-
listener: ((event) => void)
-
- (event): void
-
Returns void
-
Optional
passive?: boolean
-
Optional
target?: Target
Returns void
Never call addEventListener again, just let this hook handle it
Example