Files
test_task_crm/frontend/src/hooks/use-debounce.ts
T
Artem Kashaev 8718df9686 feat: add deals, tasks, and organizations pages with CRUD functionality
- Implemented DealsPage with deal creation, updating, and filtering features.
- Added OrganizationsPage to manage and switch between organizations.
- Created TasksPage for task management, including task creation and filtering.
- Updated router to include new pages for navigation.
2025-12-01 13:46:56 +05:00

13 lines
334 B
TypeScript

import { useEffect, useState } from 'react'
export const useDebounce = <T>(value: T, delay = 300) => {
const [debounced, setDebounced] = useState(value)
useEffect(() => {
const timer = window.setTimeout(() => setDebounced(value), delay)
return () => window.clearTimeout(timer)
}, [value, delay])
return debounced
}