React Hookers - v6.3.0
    Preparing search index...

    Function useHandler

    • Returns a stable function identity that is a no-op during the initial render and after the component is unmounted.

      Type Parameters

      • A extends any[]

        The handler argument types.

      • R

        The handler return value.

      Parameters

      • fn: ((...args: A) => R) | null | undefined

        A callback that is invoked by the returned handler.

      Returns (...args: A) => R | undefined

      A stable function identity.

      function MyComponent(props) {
      // Handler identity never changes
      const handleClick = useHandler(props.onClick);
      }