الانتقال إلى المحتوى
FrontendReact· 8 دقائق للقراءة

useDeferredValue Is Not a Debounce: How Transitions Keep Typing Responsive

There's no timer inside: React renders the slow part in the background, starts right away and drops that work the moment you type again.

ReadIn

مقال كل يوم يفرق معاك

21 نوفمبر 2026
  • كاتب موثّق
  • React 19
محتويات المقال

A support dashboard filters 3,000 tickets as an agent types, and every keystroke re-renders the whole list, so typing stutters. The first fix is a 300 ms . Now nothing moves until the agent pauses, even on a fast laptop, and when the list finally renders, the next keystroke still freezes until it's done. The second fix, after someone reads that useDeferredValue is "React's built-in debounce", makes typing smooth. Then the same developer uses it for the search API and is surprised that the server logs still show one request per keystroke.

The common misconception

The belief: useDeferredValue and startTransition are React's debounce. They hold an update back for some fixed amount of time, so fewer renders, and fewer requests, happen while the user types.

It's easy to see why. From the outside the result looks the same: the input moves and the list catches up a moment later. React's own docs say the deferred value "lags behind", which sounds like a timer. Both tools get recommended for the same search box over the same slow list, and a name like "transition" suggests something scheduled for later, like setTimeout. The half that's true: both postpone work the user doesn't need this very millisecond. What differs is what decides when that work runs, and whether it can be stopped once it has started.

What actually happens

Two renders, not a timer

When query changes, useDeferredValue(query) makes React render twice. First comes an urgent render with the new query but the old deferred value, so the input shows the keystroke right away. Then React tries a background render with the new value for the slow part.

There's no delay between the two. The reference says it directly: useDeferredValue causes no fixed delay, and React starts the background render as soon as the first one finishes. On a powerful laptop the list catches up almost instantly. On a slow phone it lags behind in proportion to how slow the device is. You never pick a number, so you never pick the wrong one.

The background render can be thrown away

This is the part a debounce can't copy. The deferred background render can be interrupted, and so can a . If the agent types another letter while React is halfway through rendering the list for "ref", React drops that work, handles the keystroke, and starts again with "refu". It always works toward the latest value.

A debounce doesn't make rendering interruptible; it only postpones it. When the timer fires, React renders 3,000 rows in one go, and a keystroke that arrives meanwhile waits. React's docs call debouncing and throttling blocking for exactly this reason. And if someone types faster than the list can render, the deferred list only updates after they stop typing. That looks like a debounce, but it falls out of interruption, not a timer.

TSX TicketSearch.tsx
import { useEffect, useState } from "react";export function TicketSearch({ tickets }: { tickets: Ticket[] }) {  const [text, setText] = useState("");  const [query, setQuery] = useState("");  // Debounce: wait 300 ms after the last keystroke  useEffect(() => {    const id = setTimeout(() => setQuery(text), 300);    return () => clearTimeout(id);  }, [text]);  return (    <>      <input value={text} onChange={(e) => setText(e.target.value)} />      {/* 3,000 rows: once this render starts, typing waits */}      <TicketRows tickets={tickets} query={query} />    </>  );}

In the right-hand version the input owns the real query, and only the list reads the deferred one. While React renders the list in the background, query !== deferredQuery, so the old results are dimmed instead of pretending to be current.

startTransition is the same idea for state you set

useDeferredValue is for a value you receive, such as a prop or a Hook's result. When you own the setter, you can mark the update yourself with startTransition. The function you pass runs immediately, not later like a setTimeout callback; React just marks every state update made during that call as a Transition.

One rule trips people up: a Transition can't update the state that controls a text input, because the input has to reflect the keystroke synchronously. So keep two pieces of state, one urgent for the field and one updated in a Transition for everything that reads it:

TSX TicketFilter.tsx
import { memo, useState, useTransition } from "react";const SlowRows = memo(TicketRows);export function TicketFilter({ tickets }: { tickets: Ticket[] }) {  const [text, setText] = useState("");  const [query, setQuery] = useState("");  const [isPending, startTransition] = useTransition();  function handleChange(value: string) {    setText(value); // urgent: the input must show it now    startTransition(() => setQuery(value)); // the list can wait  }  return (    <>      <input value={text} onChange={(e) => handleChange(e.target.value)} />      {isPending && <small>Updating…</small>}      <SlowRows tickets={tickets} query={query} />    </>  );}

Neither one sends fewer requests

Deferring changes when React renders, not what your code does. The reference states that useDeferredValue doesn't by itself prevent extra network requests: a search box that fetches per query still fetches per keystroke. If the expensive work isn't rendering, like a request or an analytics call, a debounce is still the right tool, and React's docs note you can use both together: debounce the request, defer the render. One bonus when the list suspends while loading: with a deferred value, users keep seeing the old results instead of the Suspense fallback.

QuestionDebounce (setTimeout)useDeferredValue / startTransition
When does the slow update start?After the fixed delay you choseRight after the urgent render
On a fast device?Still waits the full delayCatches up almost immediately
A keystroke during the slow render?Waits until the render endsInterrupts it; React restarts with the latest value
Network requests?Fewer: one per pauseUnchanged: one per change
Does the input update at once?Yes, if its own state isn't debouncedYes, in the urgent render

How to apply it in your project

  1. Find timers that guard rendersSearch for setTimeout, debounce and throttle around state updates. Note which ones only delay a value that a slow component renders.
  2. Pick the tool by what's slowIf rendering is slow, replace the timer with useDeferredValue for a value you receive, or two states plus startTransition for state you own. If a request or other side work is the cost, keep the debounce.
  3. Make the urgent render cheapWrap the slow component in memo and pass it primitives or values created outside render, so the urgent pass skips it.
  4. Test on a slow CPUUse your browser's performance tools to slow the CPU down, type quickly, and check that the input never waits for the list.

Key takeaways

  • useDeferredValue and startTransition have no delay: the background render starts as soon as the urgent one ends.
  • Background renders are interruptible, so a keystroke never waits for the list; a debounce only postpones the blocking render.
  • The slow child needs memo, and a Transition can't drive a text input's own state.
  • Deferring doesn't reduce network requests; keep a debounce for those, and combine both when you need to.

📚 المصادر

  1. useDeferredValue — React API Reference
  2. useTransition — React API Reference
  3. startTransition — React API Reference
  4. memo — React API Reference

التعليقات (0)