useLockFn
A hook to lock a function until the previous promise is resolved
Installation
npx shadcn@latest add @shadcnhooks/use-lock-fnAPI
/**
* A hook to lock a function until the previous promise is resolved
* @param fn - The function to lock
* @returns The locked function
*/
export function useLockFn<P extends any[] = any[], V = any>(
fn: (...args: P) => Promise<V>,
): (...args: P) => Promise<V | undefined>Last updated on