Updates a value using the debounce strategy. Commonly used with the useEffect hook to check when the returned 'debouncedValue' has been updated
starting value
setTimeout delay time
const [debouncedValue, setVal, val] = useDebounce<string>('intialValue', 500);const func = () => setVal('newValue');useEffect(() => {console.log(debouncedValue);}, [debouncedValue]); Copy
const [debouncedValue, setVal, val] = useDebounce<string>('intialValue', 500);const func = () => setVal('newValue');useEffect(() => {console.log(debouncedValue);}, [debouncedValue]);
Updates a value using the debounce strategy. Commonly used with the useEffect hook to check when the returned 'debouncedValue' has been updated