8718df9686
- 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.
13 lines
334 B
TypeScript
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
|
|
}
|