Skip to content

QuizNot attempted

What useDeferredValue does

The user types "a", then quickly "ab", then "abc" into a controlled input that sets query. Broadly, what does useDeferredValue allow React to do?
function List({ query }) {
const deferredQuery = useDeferredValue(query);
const isStale = query !== deferredQuery;
console.log('rendering list for', deferredQuery, 'stale:', isStale);
return <div>results for {deferredQuery}</div>;
}
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • Render with the latest query immediately for urgent updates elsewhere, while deferredQuery may lag behind and "catch up" in a lower-priority render, letting React keep the input responsive
  • useDeferredValue returns the previous value during urgent renders and schedules a lower-priority, interruptible re-render with the new one, so the input stays responsive while deferredQuery lags and catches up.
  • Not 'skip until typing stops': it re-renders as soon as React has spare time, not after a pause.
  • Not a fixed-timer debounce: there is no delay, the timing adapts to the device.
  • Not synchronous on every keystroke: the opposite of its purpose.