useDebouncedState

Keep a state whose updates are applied only after the user stops changing it.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

The value changes 500ms after the last keystroke.

APIs

useDebouncedState

const useDebouncedState = <T>(
  initialValue: T,
  wait: number,
  options?: { leading?: boolean },
) => [T, (value: T) => void]
Edit this page on GitHub