Skip to main content
InterviewHubPRO
Section Overview
Q317

Question 317 of 407

Part 9: React Hooks Deep Dive (262 - 316)

78%
React Core & Hooks (407 Qs)•Part 9: React Hooks Deep Dive (262 - 316)

What is Concurrent Rendering? (Legacy)

junior LevelCode ExampleHooks

The Concurrent rendering makes React apps to be more responsive by rendering component trees without blocking the main UI thread. It allows React to interrupt a long-running render to handle a high-priority event. i.e, When you enabled concurrent Mode, React will keep an eye on other tasks that need to be done, and if there's something with a higher priority it will pause what it is currently rendering and let the other task finish first. You can enable this in two ways,

javascript
   // 1. Part of an app by wrapping with ConcurrentMode
   <React.unstable_ConcurrentMode>
     <Something />
   </React.unstable_ConcurrentMode>;

   // 2. Whole app using createRoot
   ReactDOM.unstable_createRoot(domNode).render(<App />);