useDebouncedState
API
import useDebouncedState from '@restart/hooks/useDebouncedState'
useDebouncedState
<T>(initialState: T, delay: number) => [T,Dispatch<SetStateAction<T>>]Similar to
useState
, except the setter function is debounced by the specified delay.const [value, setValue] = useDebouncedState('test', 500)setValue('test2')Parameters
initialState
Tinitial state value
delay
numberThe milliseconds delay before a new value is set
Return Value [T,Dispatch<SetStateAction<T>>]