Hex Core JS
    Preparing search index...

    Function useEventListener

    • Adds an event listener to the given target element and removes the listener before unmount.

      Parameters

      • target: EventTarget | null | undefined

        The element to attach the event listener to, can be window, document, or an HTML element.

      • type: string

        The event type (same as for addEventListener).

      • listener: (event: Event) => void

        The function to call when an event occurs (same as for addEventListener).

      • options: UseEventListenerOptions = {}

        Options for the event listener (same as for addEventListener, with additional disabled and rateLimitMS).

      Returns void