• Updates a value using the debounce strategy. Commonly used with the useEffect hook to check when the returned 'debouncedValue' has been updated

    Type Parameters

    • T

    Parameters

    • initialValue: T

      starting value

    • time: number

      setTimeout delay time

    Returns [T, Dispatch<T>, T]

    Example

    const [debouncedValue, setVal, val] = useDebounce<string>('intialValue', 500);
    const func = () => setVal('newValue');
    useEffect(() => {
    console.log(debouncedValue);
    }, [debouncedValue]);

Generated using TypeDoc