• Uses an effect to add event listeners to a target when the component mounts, and remove them when the component unmounts.

    Type Parameters

    • Target extends EventTarget

      The type of the target, which must extend EventTarget.

    Parameters

    • target: Target

      The target to add event listeners to.

    • handlers: EventHandlers = {}

      The event handlers to add to the target.

    • deps: undefined | any[] = undefined

      The dependencies of the effect. The effect will run again if these dependencies change.

    Returns void