@tater-archives/react-use-handler
v1.0.3
Published
React hook to set global/arbitrary event handlers
Downloads
1
Maintainers
Readme
react-use-handler
A react hook to set global/arbitrary event handlers.
Example Usage
useHandler('click', useCallback(() => closeDialog(), []));
// It is recommended to wrap the function with useCallback to prevent the
// function from being changed every render
Using an event target other than window
:
useHandler('resize', useCallback(() => fixSizing(), []), document);