mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
16 lines
477 B
TypeScript
16 lines
477 B
TypeScript
import { Dispatch, SetStateAction } from 'react';
|
|
/**
|
|
* Similar to `useState`, except the setter function is debounced by
|
|
* the specified delay.
|
|
*
|
|
* ```ts
|
|
* const [value, setValue] = useDebouncedState('test', 500)
|
|
*
|
|
* setValue('test2')
|
|
* ```
|
|
*
|
|
* @param initialState initial state value
|
|
* @param delay The milliseconds delay before a new value is set
|
|
*/
|
|
export default function useDebouncedState<T>(initialState: T, delay: number): [T, Dispatch<SetStateAction<T>>];
|