@tater-archives/react-use-handler
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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);

/@tater-archives/react-use-handler/

    Package Sidebar

    Install

    npm i @tater-archives/react-use-handler

    Weekly Downloads

    0

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    6.93 kB

    Total Files

    10

    Last publish

    Collaborators

    • tater-archives