WhoBuilt

React for Two Threads

Sep 8, 2025· 38 min· 1.6K views·Watch on YouTube

Speakers

Xuan Huang, who works with the React, React Native, and Hermes teams; Ziqi Zhen, a software developer at Vance; and Haoyang Wang present React Lynx and its two-thread React model at React Universe Conf 2025.

Why React needs two threads

Xuan Huang contrasts the web’s single main thread with React Native’s earlier asynchronous Paper architecture and today’s Fabric renderer. A single thread enables synchronous layout measurement and scheduling control, but expensive renders can drop frames. Paper avoids blocking the main thread, while its asynchrony can make input and frame timing harder to control.

Instant rendering and responsive interactions

Ziqi Zhen and Xuan describe rendering a static first frame on the main thread, then hydrating it on the background thread. They call this instant first-frame rendering. For a slider, moving event handling to the main thread avoids cross-thread latency; main-thread components aim to retain synchronous updates while restoring React’s component reactivity and lifecycle. Those components are experimental, while the rest of React Lynx is described as production-ready.

React Lynx and the dual-thread model

The presenters credit Reanimated Worklets, Next.js and React Server Components, and Preact as influences on React Lynx. Lynx is an open-source cross-platform technology used at TikTok, and its model runs JavaScript on both a background thread and the main thread. The team presents the approach as a way to combine parallel work with React’s structured programming model.

Bringing the model to the web

Haoyang Wang demonstrates a React app where decoding HEIC images on the main thread brings the lowest frame rate to four FPS. With Web Workers handling background work, the demo reaches about 60 FPS. For Lynx on the web, the team reuses JavaScript and CSS bundles and chooses browser styling and painting, including web components and Shadow DOM to handle selector isolation. A Rust tokenizer cuts time to interactive by about 40% compared with the JavaScript transformer.

Takeaways

  • Move CPU-heavy work, such as image decoding, off the browser’s main thread to protect animation frame rates.
  • Keep latency-sensitive event handlers on the UI thread when a cross-thread round trip makes interactions feel delayed.
  • Treat main-thread components as experimental; they are intended to keep React reactivity and lifecycle while enabling synchronous UI updates.
  • When adapting a rendering system for the web, account for accessibility, screen-reader support, testing, bundle size, and integration with existing pages.
  • The talk’s Lynx for Web approach reuses JavaScript and CSS bundles and relies on browser styling and painting.

Mentioned in this talk

Search inside this talk

What was claimed 12

Related talks