Function useConditionalCallback

Custom hook to create a conditional callback.

  • Type Parameters

    • T extends ((...args: any[]) => any)

    Parameters

    • callback: ConditionalCallback<T>

      The function to invoke if conditions are met.

    • conditions: boolean | boolean[]

      A single boolean or array of booleans; the callback is invoked only if all are true.

    Returns ((...args: Parameters<T>) => void)

    A memoized callback that only calls callback if all conditions are true.

      • (...args): void
      • Parameters

        • Rest...args: Parameters<T>

        Returns void