Edit in GitHubLog an issue


A React Hook that gives you the ability to add a callback function when an event is triggered on an object.

This function attaches an event listener to a target object on mount and removes the listener on unmount.

See addEventListener()


targetEventTargetThe EventTarget to attach the listener to
typeStringThe type of Event to listen for, e.g. 'resize', 'error', etc.
listenerfunctionA callback function that is invoked when the event is triggered
...restanyAny other arguments to pass to the addEventListener() function

Source Code: pwa-studio/packages/peregrine/lib/hooks/useEventListener.js

  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.