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.
Parameters
Name
Type
Description
listener
functionA callback function that is invoked when the event is triggered
...rest
anyAny other arguments to pass to the addEventListener() function
Source Code: pwa-studio/packages/peregrine/lib/hooks/useEventListener.js