Neophobe Plebeian Mumpsimus

    @react-hookbox/event-callback
    TypeScript icon, indicating that this package has built-in type declarations

    1.3.0 • Public • Published

    @react-hookbox/event-callback

    Material UI's useEventCallback with better type definitions.

    NPM Minzipped Bundle Size

    Install

    npm install --save @react-hookbox/event-callback

    or

    yarn add @react-hookbox/event-callback

    Usage

    both for JavaScript and Typescript:

    import { useEventCallback } from '@react-hookbox/event-callback';
    // OR
    // import useEventCallback from '@react-hookbox/event-callback';
    
    // then
    const myCallback = useEventCallback((num, str) => {
      return str.repeat(Math.min(num, 2));
    });

    useEventCallback updates the callback it's using after an "effective-time". So make sure to use it as a callback or in a useEffect which is placed after useEventCallback;

    Params

    • fn. This is a required function parameter. The returned value will have the same type.

      Note: The return value will be updated after an "effect-ive time".

      That means the returned value should be used as an event callback or in an event callback.

    License

    MIT © hakobpogh

    Install

    npm i @react-hookbox/event-callback

    DownloadsWeekly Downloads

    0

    Version

    1.3.0

    License

    MIT

    Unpacked Size

    12.2 kB

    Total Files

    17

    Last publish

    Collaborators

    • hakobpogh