Skip to content

Executes a callback whenever an event occurs on the global object.

Notifications You must be signed in to change notification settings

aozoragh/useOnGlobalEvent-react-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

"# useOnGlobalEvent-react-hook" Use the useRef() hook to create a variable, listener, which will hold the listener reference. Use the useRef() hook to create a variable that will hold the previous values of the type and options arguments. Use the useEffect() hook and EventTarget.addEventListener() to listen to the given event type on the Window global object. Use EventTarget.removeEventListener() to remove any existing listeners and clean up when the component unmounts.

About

Executes a callback whenever an event occurs on the global object.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published