MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Concurrent Rendering with useTransition0%
Study Materials
React.js for AdvancedProgress 0%
1.1Control Props and Inversion of Control Pattern1.2State Reducer Pattern in Advanced React1.3Prop Getters and Flexible Design Systems1.4Headless UI Architecture and Accessibility Primitives
7.1Concurrent Rendering with useTransition7.2Deferred Value Updates with useDeferredValue7.3Synchronous Layout Calculations with useLayoutEffect7.4External Store Synchronization with useSyncExternalStore
HomeTutorialsReact.js for AdvancedConcurrent Rendering with useTransition
Deferred Value Updates with useDeferredValue

Concurrent Rendering with useTransition

Beginner12 min read•Updated: 2026-11-18•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

Prior to React 18, state updates in React were synchronous and un-interruptible. If a state change triggered a computationally intensive re-render of thousands of DOM elements or complex charts, the main JavaScript thread froze, dropping frames and causing button clicks, text input typing, and scroll events to lag. useTransition unlocks Concurrent React, enabling you to mark state updates as non-blocking transitions.


1. Urgent Updates vs Non-Urgent Transitions

React divides user interactions into two core categories:

  1. 1
    Urgent Updates: Direct physical interactions requiring immediate feedback (typing in an input field, clicking a toggle button, hovering a dropdown). Users feel lag if these take longer than ~16ms.
  2. 2
    Transition Updates: Secondary UI views transitioning between states (filtering a table of 10,000 items, switching a search results tab, rendering complex data graphs). Users tolerate a brief delay as long as the page remains interactive.

2. Anatomy of useTransition

The useTransition hook returns a boolean flag isPending and a startTransition dispatcher function:

1const [isPending, startTransition] = useTransition();
  • startTransition(callback): Wraps state setter calls. React marks the resulting re-render as low priority and interruptible. If an urgent update occurs while the transition is calculating, React pauses the transition, renders the urgent update, and resumes or restarts the transition.
  • isPending: Boolean indicating whether a low-priority transition is currently running in the background.

3. High-Performance Filtering Example

Here is how useTransition keeps an input responsive while filtering 20,000 records:

1import React, { useState, useTransition, useMemo } from "react";
2 
3// Generate massive synthetic dataset
4const RAW_DATABASE = Array.from({ length: 15000 }, (_, i) => ({
5 id: i,
6 name: `Enterprise Record #${i + 1}`,
7 department: i % 3 === 0 ? "Finance" : i % 2 === 0 ? "Engineering" : "Marketing",
8}));
9 
10export function ConcurrentFilterList() {
11 const [inputValue, setInputValue] = useState("");
12 const [filterTerm, setFilterTerm] = useState("");
13 const [isPending, startTransition] = useTransition();
14 
15 const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
16 const nextValue = e.target.value;
17 
18 // 1. URGENT: Update the input text immediately so typing feels instant
19 setInputValue(nextValue);
20 
21 // 2. NON-URGENT: Defer heavy list filtering to concurrent background thread
22 startTransition(() => {
23 setFilterTerm(nextValue);
24 });
25 };
26 
27 const filteredItems = useMemo(() => {
28 if (!filterTerm) return RAW_DATABASE;
29 return RAW_DATABASE.filter((item) =>
30 item.name.toLowerCase().includes(filterTerm.toLowerCase())
31 );
32 }, [filterTerm]);
33 
34 return (
35 <div className="p-8 bg-slate-900 text-slate-100 min-h-screen">
36 <h1 className="text-xl font-bold mb-4">Concurrent Filtering Demo</h1>
37 
38 <div className="flex items-center gap-4 mb-6">
39 <input
40 type="text"
41 value={inputValue}
42 onChange={handleInputChange}
43 placeholder="Type rapidly to filter 15,000 items..."
44 className="px-4 py-2 bg-slate-800 border border-slate-700 rounded-lg w-96 text-white focus:outline-none focus:ring-2 focus:ring-cyan-500"
45 />
46 
47 {isPending && (
48 <span className="flex items-center gap-2 text-cyan-400 text-sm font-medium">
49 <span className="h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent" />
50 Recalculating list in background...
51 </span>
52 )}
53 </div>
54 
55 <p className="text-xs text-slate-500 mb-2">Displaying {filteredItems.length} records</p>
56 <div className="h-96 overflow-y-auto border border-slate-800 rounded-lg divide-y divide-slate-800 bg-slate-950 p-2">
57 {filteredItems.slice(0, 100).map((item) => (
58 <div key={item.id} className="py-1.5 px-3 text-sm text-slate-300 flex justify-between">
59 <span>{item.name}</span>
60 <span className="text-xs text-slate-500">{item.department}</span>
61 </div>
62 ))}
63 </div>
64 </div>
65 );
66}

4. Key Rules and Caveats

  1. 1
    Synchronous Setters Only: The callback passed to startTransition must be synchronous. You cannot pass an async function or wrap setTimeout:
1 // ❌ Incorrect: async callback
2 startTransition(async () => {
3 const res = await fetchData();
4 setData(res);
5 });
6 
7 // ✅ Correct: perform async work first, transition the state setter
8 const res = await fetchData();
9 startTransition(() => {
10 setData(res);
11 });
  1. 1
    Cannot Control Text Input State Directly: Do not wrap controlled text inputs' immediate state in startTransition; controlled inputs require urgent synchronous feedback to prevent cursor position jumping.

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
What problem does useTransition solve in React 18?
Question 2
What are the two return values of the useTransition() hook?
Question 3
Why should the state controlling an <input value={text} /> element remain an urgent update?
Question 4
Can you pass an async function directly into startTransition()?
Question 5
What happens if a user types a new character while React is halfway through rendering a transition?
Next Lesson

Deferred Value Updates with useDeferredValue

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Analyzing Bundle Sizes with Rollup and Webpack VisualizerDeferred Value Updates with useDeferredValue

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master React.js for Advanced with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext