Skip to content
On this page

useRefDebounced

debounces the update value of a ref

Parameters

typescript
import { refDebounced } from '@elonehoo/pistachio'

refDebounced(delay)
refDebounced(value, delay)
import { refDebounced } from '@elonehoo/pistachio'

refDebounced(delay)
refDebounced(value, delay)
ParametersTypeRequiredDefaultDescription
delaynumbertruedebounce delay
valueTfalseundefinedinitial value

State

The refDebounced function retuns a ref:

typescript
import { refDebounced } from '@elonehoo/pistachio'

const debouncedValue = refDebounced()
import { refDebounced } from '@elonehoo/pistachio'

const debouncedValue = refDebounced()
StateTypeDescription
debouncedValueRef<T>debounced ref

Released under the MIT License.