Delay a value until it stops changing for the given time.
This is custom React hooks, you need to follow the Basic Rules when you use it.
The debounced value follows the input 500ms after the last keystroke.
const useDebouncedValue = <T>(
value: T,
wait: number,
options?: { leading?: boolean },
) => [T, () => void]