Course contentsShow
← React
Lesson 1468 of 2,39636. Concurrent ReactFree lesson

Comparing Blocking vs Concurrent Behavior

Build side-by-side demos showing input lag with blocking updates vs smooth typing with concurrent features.

Comparing Blocking vs Concurrent Behavior

What you'll learn: How to build side-by-side demos that reveal the dramatic difference between blocking updates and concurrent features like useTransition.

The Core Idea

The best way to understand concurrent React is to see it in action. By building two versions of the same feature—one using traditional blocking updates, one using useTransition or useDeferredValue—you can directly compare the user experience. The blocking version will show input lag when typing triggers heavy computation, while the concurrent version keeps the UI responsive.

The Side-by-Side Demo Pattern

Create two identical text inputs: one updates state directly (blocking), the other wraps the update in startTransition (concurrent). Both trigger the same expensive operation—like filtering a 10,000-item list.

function BlockingDemo() {
  const [input, setInput] = useState('');
  const [query, setQuery] = useState('');

  return (
    <input 
      value={input}
      onChange={e => {
        setInput(e.target.value);
        setQuery(e.target.value); // Blocks!
      }}
    />
  );
}

function ConcurrentDemo() {
  const [input, setInput] = useState('');
  const [query, setQuery] = useState('');
  const [isPending, startTransition] = useTransition();

  return (
    <input 
      value={input}
      onChange={e => {
        setInput(e.target.value);
        startTransition(() => {
          setQuery(e.target.value); // Non-blocking!
        });
      }}
    />
  );
}

What You'll Notice

In the blocking demo, typing feels sluggish—each keystroke waits for the heavy render to complete. In the concurrent demo, the input stays buttery smooth while the filtered results update in the background. It's like the difference between a frozen computer and one that stays responsive while processing.

Key Takeaway: Side-by-side demos make concurrent React's benefits tangible—you can literally feel the difference between blocking and non-blocking updates when typing.