Chapter 11 · 6 examples

Implementing advanced debouncing and throttling with Refs

What are debouncing and throttling? · Debounced callback in React: dealing with re-renders · Debounced callback in React: dealing with state inside

  1. Example 1Debounce versus throttle
  2. Example 2Debounce recreated on render
  3. Example 3Memoizing the debounced call
  4. Example 4Stale state from dependencies
  5. Example 5Naive Ref with useEffect
  6. Example 6The useDebounce hook