-
Notifications
You must be signed in to change notification settings - Fork 73
useEventListener не работает с дом элементом как первый аргумент #454
Copy link
Copy link
Open
Description
reactuse/packages/core/src/hooks/useEventListener/useEventListener.ts
Lines 65 to 85 in 1ddbf8f
| * @overload | |
| * @template Event Key of window event map | |
| * @param {Window} target The window object to attach the event listener to | |
| * @param {Event | Event[]} event An array of event types to listen for | |
| * @param {(this: Window, event: WindowEventMap[Event]) => void} handler The event handler function | |
| * @param {UseEventListenerOptions} [options] Options for the event listener | |
| * @returns {void} | |
| * | |
| * @example | |
| * useEventListener(window, 'click', () => console.log('click')); | |
| * | |
| * @overload | |
| * @template Event Key of window event map | |
| * @param {Document} target The window object to attach the event listener to | |
| * @param {Event | Event[]} event An array of event types to listen for | |
| * @param {(this: Document, event: DocumentEventMap[Event]) => void} handler The event handler function | |
| * @param {UseEventListenerOptions} [options] Options for the event listener | |
| * @returns {void} | |
| * | |
| * @example | |
| * useEventListener(document, 'click', () => console.log('click')); |
по доке указано, что можно передавать элемент как первый аргумент, но ts ругается и это не работает
https://codesandbox.io/p/sandbox/yshdc3?file=%2Fsrc%2FApp.tsx%3A14%2C1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels