Facebook announces React Fiber, a rewrite of its React framework

Comment

Image Credits:

Facebook has completely rewritten React, its popular JavaScript library for building user interfaces. The company hasn’t previously talked much about React Fiber, as the project is called, but it has actually been working on it for a while. It’s now ready to talk about this project publicly in more detail (after word about it started spreading last year) and the plan is to put this rewrite into the hands of developers once React 16.0 launches later this year. It’s already in use on Facebook.com today, which clearly indicates that Facebook itself thinks it’s ready for prime time.

In addition, it is also launching a rewrite of Relay, its framework for building data-heavy applications.

React Fiber

The idea behind React Fiber, the company tells me, is to take what the company has learned from developing React the first time around and put that into an updated framework that is still fully backwards compatible with existing React-based applications. React Fiber, Facebook tells me, will become the foundation of any future improvements and feature development of the React framework.

The main focus here was to make React as responsive as possible, Facebook engineer — and member of the React core team — Ben Alpert told me in an interview earlier this week. “When we develop React, we’re always looking to see how we can help developers build high-quality apps quicker,” he noted. “We want to make it easier to make apps that perform very well and make them responsive.”

In light of this theme, it’s no surprise that the highlights of this new release are built-in primitives for scheduling and incremental rendering. “We want to make sure we render the right stuff at the right time,” Alpert said, and added that “responsiveness was a huge push here.”

But why rewrite React from scratch? “It was not necessarily that the old code base was bad, but we wanted to start with a new foundation that could power everything we do going forward,” Alpert said. That means the new code was developed from the ground up to be extensible, for example.

Alpert stressed that React Fiber will be backward compatible, though as with all major React updates, there will be a few small breaking changes. The team says it doesn’t anticipate that these will be problematic for developers, though. “We always had a strong API contract, so that gives us the flexibility to reimplement,” he added.

Relay Modern

As Facebook also today announced, Relay — the company’s JavaScript framework for building data-driven applications — has also been rewritten with a similar emphasis on performance and extensibility. Relay combines React with Facebook’s GraphQL query language and now Relay Modern, as the company calls this rewrite, is meant to push this concept further and overcome some of the limitations of the original design. That also meant simplifying some of the design to enhance the overall performance of the framework. “Relay Modern retains the best parts of Relay — colocated data and view definitions, declarative data fetching — while also simplifying the API, adding features, improving performance, and reducing the size of the framework,” the team explains in today’s announcement. To do this, the team implemented a number of changes, but most importantly, it adopted static queries and ahead-of-time optimizations.

Static queries essentially ensure that complex queries that aren’t altered by runtime conditions can be pre-built and offloaded to Facebook’s servers. So instead of sending complex queries across the network, all an application has to send is a string that identifies the pre-set query and the variables needed to complete it. Related to this, the ahead-of-time optimization feature in the Relay compiler now looks at the query structure to optimize the query that is now stored on the server to execute it faster — and hence return results to the user faster, too. Other new features in React Modern include built-in garbage collection, for example.

For developers who are already using an older version of Relay, Relay Modern comes with a compatibility API.

Facebook says that when its teams switched the Marketplace tab in the Facebook app from Relay to Relay Modern, the time to interaction on Android improved by an average of 900ms. While that doesn’t sound like much, every second on mobile counts, and that’s enough to make an application feel noticeably more responsive than before.

More TechCrunch

The Series C funding, which brings its total raise to around $95 million, will go toward mass production of the startup’s inaugural products

AI chip startup DEEPX secures $80M Series C at a $529M valuation 

A dust-up between Evolve Bank & Trust, Mercury and Synapse has led TabaPay to abandon its acquisition plans of troubled banking-as-a-service startup Synapse.

Infighting among fintech players has caused TabaPay to ‘pull out’ from buying bankrupt Synapse

The problem is not the media, but the message.

Apple’s ‘Crush’ ad is disgusting

The Twitter for Android client was “a demo app that Google had created and gave to us,” says Particle co-founder and ex-Twitter employee Sara Beykpour.

Google built some of the first social apps for Android, including Twitter and others

WhatsApp is updating its mobile apps for a fresh and more streamlined look, while also introducing a new “darker dark mode,” the company announced on Thursday. The messaging app says…

WhatsApp’s latest update streamlines navigation and adds a ‘darker dark mode’

Plinky lets you solve the problem of saving and organizing links from anywhere with a focus on simplicity and customization.

Plinky is an app for you to collect and organize links easily

The keynote kicks off at 10 a.m. PT on Tuesday and will offer glimpses into the latest versions of Android, Wear OS and Android TV.

Google I/O 2024: How to watch

For cancer patients, medicines administered in clinical trials can help save or extend lives. But despite thousands of trials in the United States each year, only 3% to 5% of…

Triomics raises $15M Series A to automate cancer clinical trials matching

Welcome back to TechCrunch Mobility — your central hub for news and insights on the future of transportation. Sign up here for free — just click TechCrunch Mobility! Tap, tap.…

Tesla drives Luminar lidar sales and Motional pauses robotaxi plans

The newly announced “Public Content Policy” will now join Reddit’s existing privacy policy and content policy to guide how Reddit’s data is being accessed and used by commercial entities and…

Reddit locks down its public data in new content policy, says use now requires a contract

Eva Ho plans to step away from her position as general partner at Fika Ventures, the Los Angeles-based seed firm she co-founded in 2016. Fika told LPs of Ho’s intention…

Fika Ventures co-founder Eva Ho will step back from the firm after its current fund is deployed

In a post on Werner Vogels’ personal blog, he details Distill, an open-source app he built to transcribe and summarize conference calls.

Amazon’s CTO built a meeting-summarizing app for some reason

Paris-based Mistral AI, a startup working on open source large language models — the building block for generative AI services — has been raising money at a $6 billion valuation,…

Sources: Mistral AI raising at a $6B valuation, SoftBank ‘not in’ but DST is

You can expect plenty of AI, but probably not a lot of hardware.

Google I/O 2024: What to expect

Dating apps and other social friend-finders are being put on notice: Dating app giant Bumble is looking to make more acquisitions.

Bumble says it’s looking to M&A to drive growth

When Class founder Michael Chasen was in college, he and a buddy came up with the idea for Blackboard, an online classroom organizational tool. His original company was acquired for…

Blackboard founder transforms Zoom add-on designed for teachers into business tool

Groww, an Indian investment app, has become one of the first startups from the country to shift its domicile back home.

Groww joins the first wave of Indian startups moving domiciles back home from US

Technology giant Dell notified customers on Thursday that it experienced a data breach involving customers’ names and physical addresses. In an email seen by TechCrunch and shared by several people…

Dell discloses data breach of customers’ physical addresses

Featured Article

Fairgen ‘boosts’ survey results using synthetic data and AI-generated responses

The Israeli startup has raised $5.5M for its platform that uses “statistical AI” to generate synthetic data that it says is as good as the real thing.

16 hours ago
Fairgen ‘boosts’ survey results using synthetic data and AI-generated responses

Hydrow, the at-home rowing machine maker, announced Thursday that it has acquired a majority stake in Speede Fitness, the company behind the AI-enabled strength training machine. The rowing startup also…

Rowing startup Hydrow acquires a majority stake in Speede Fitness as their CEO steps down

Call centers are embracing automation. There’s debate as to whether that’s a good thing, but it’s happening — and quite possibly accelerating. According to research firm TechSci Research, the global…

Retell AI lets companies build ‘voice agents’ to answer phone calls

TikTok is starting to automatically label AI-generated content that was made on other platforms, the company announced on Thursday. With this change, if a creator posts content on TikTok that…

TikTok will automatically label AI-generated content created on platforms like DALL·E 3

India’s mobile payments regulator is likely to extend the deadline for imposing market share caps on the popular UPI (unified payments interface) payments rail by one to two years, sources…

India likely to delay UPI market caps in win for PhonePe-Google Pay duopoly

Line Man Wongnai, an on-demand food delivery service in Thailand, is considering an initial public offering on a Thai exchange or the U.S. in 2025.

Thai food delivery app Line Man Wongnai weighs IPO in Thailand, US in 2025

Ever wonder why conversational AI like ChatGPT says “Sorry, I can’t do that” or some other polite refusal? OpenAI is offering a limited look at the reasoning behind its own…

OpenAI offers a peek behind the curtain of its AI’s secret instructions

The federal government agency responsible for granting patents and trademarks is alerting thousands of filers whose private addresses were exposed following a second data spill in as many years. The…

US Patent and Trademark Office confirms another leak of filers’ address data

As part of an investigation into people involved in the pro-independence movement in Catalonia, the Spanish police obtained information from the encrypted services Wire and Proton, which helped the authorities…

Encrypted services Apple, Proton and Wire helped Spanish police identify activist

Match Group, the company that owns several dating apps, including Tinder and Hinge, released its first-quarter earnings report on Tuesday, which shows that Tinder’s paying user base has decreased for…

Match looks to Hinge as Tinder fails

Private social networking is making a comeback. Gratitude Plus, a startup that aims to shift social media in a more positive direction, is expanding its wellness-focused, personal reflections journal to…

Gratitude Plus makes social networking positive, private and personal

With venture totals slipping year-over-year in key markets like the United States, and concern that venture firms themselves are struggling to raise more capital, founders might be worried. After all,…

Can AI help founders fundraise more quickly and easily?