Trails Packages
    Preparing search index...
    • Creates an event handler with stable function identity. The returned function will always invoke the most recent implementation of handler.

      The returned event handler can be used, for example, as an event handler in useEffect(). Because the function identity is stable, useEffect() will not re-trigger if the implementation changes.

      Warning: the function returned by useEvent must not be called during rendering. It can only be used in an effect or in a event handler callback.

      See also: https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md

      Type Parameters

      • Args extends unknown[]
      • Ret

      Parameters

      Returns (...args: Args) => Ret