tanstack-shadcn-table
Version:
A powerful, feature-rich React table component built on top of TanStack Table v8 with shadcn/ui styling. Optimized bundle size with 55% reduction through peer dependencies.
24 lines (23 loc) • 662 B
TypeScript
/**
* Custom hook for rate limiting function calls
*
* @param limit - Maximum number of calls allowed (default: 10)
* @param windowMs - Time window in milliseconds (default: 1000)
* @returns A function that returns true if the call is allowed, false otherwise
*
* @example
* ```tsx
* import { useRateLimit } from '@/lib/hooks/use-rate-limit';
*
* const checkRateLimit = useRateLimit(10, 1000);
*
* const handleInput = () => {
* if (!checkRateLimit()) {
* console.warn('Rate limit exceeded');
* return;
* }
* // Process input
* };
* ```
*/
export declare function useRateLimit(limit?: number, windowMs?: number): () => boolean;