July 9th, 2024

Enhancing the New York Times Web Performance with React 18

The New York Times upgraded to React 18 for better performance and new features like Concurrent Mode and server-side rendering. Challenges with interactive content were overcome, resulting in improved site performance.

Read original articleLink Icon
Enhancing the New York Times Web Performance with React 18

The New York Times recently upgraded its website to React 18, aiming to enhance performance and access new features. The upgrade introduced Concurrent Mode for smoother rendering, automatic batching for optimized performance, and new functionalities like server-side rendering. The move was crucial for improving Interaction to Next Paint scores, a key metric for search engine ranking. The migration process involved removing deprecated dependencies, upgrading major components, and integrating React 18 features like createRoot and hydrateRoot. However, challenges arose with highly trafficked content called "embedded interactives," impacting the site's performance. These interactives, rendered server-side with dangerouslySetInnerHTML, posed issues due to React 18's stricter hydration requirements. The team had to address script load ordering and execution nuances to ensure these interactive elements functioned correctly post-upgrade. Despite the hurdles faced, the React 18 upgrade ultimately led to significant performance gains and opened doors for future improvements on The New York Times website.

Related

Understanding React Compiler

Understanding React Compiler

React's core architecture simplifies app development but can lead to performance issues. The React team introduced React Compiler to automate performance tuning by rewriting code using AST, memoization, and hook storage for optimization.

Understanding React Compiler

Understanding React Compiler

React's core architecture simplifies development but can lead to performance issues. The React team introduced the React Compiler to automate performance tuning by rewriting code. Transpilers like Babel convert JSX for efficiency. Compilers, transpilers, and optimizers analyze and produce equivalent code. React Compiler enhances functionality using Abstract Syntax Trees, memoization, and hook storage for optimized performance.

Enhancing New York Times Web Performance with React 18

Enhancing New York Times Web Performance with React 18

The New York Times upgraded to React 18 for better performance and new features like Concurrent Mode and server-side rendering. Challenges with "embedded interactives" were overcome, leading to improved website performance.

Node 18 Ate My Website

Node 18 Ate My Website

The author upgraded their Next.js website to Node.js 18, facing issues with deprecated dependencies. They rebuilt the site with TypeScript, Contentlayer, Tailwind CSS, and Vercel Analytics, emphasizing simplicity and emerging technologies.

Show HN: A JavaScript UI library for imperative JSX

Show HN: A JavaScript UI library for imperative JSX

The @matry/dom npm package introduces a web framework for imperative JSX, aiming to enhance UI engineering by offering a more imperative approach compared to React. It provides control over rendering and flexibility in UI design. Developers are cautioned against using it in production before version 1.0.0.

Link Icon 9 comments
By @alberth - 6 months
So odd they publish to Medium, and not their own NYT platform.
By @willio58 - 6 months
Cool details! Thanks for posting.
By @rohan_ - 6 months
I thought they used Svelte?
By @lawgimenez - 6 months
I just want dark mode.
By @mewpmewp2 - 6 months
May be a stupid question, but why does a news website need React in the first place?
By @mason_mpls - 6 months
Hold on. Did they ditch their in house framework that’s supposed to be better than React? The one that rhymes with welt? I’m confused.