Spaces:
Configuration error
Configuration error
Download frontend/src/hooks/use-debounce.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 351 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/hooks/use-debounce.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/hooks/use-debounce.ts
-
curl -L -o use-debounce.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/hooks/use-debounce.ts
351 Bytes
| import { useEffect, useState } from "react"; | |
| export function useDebounce<T>(value: T, delay: number): T { | |
| const [debouncedValue, setDebouncedValue] = useState<T>(value); | |
| useEffect(() => { | |
| const timer = setTimeout(() => setDebouncedValue(value), delay); | |
| return () => clearTimeout(timer); | |
| }, [value, delay]); | |
| return debouncedValue; | |
| } | |