News

React 16 Launches with Rewritten Internals, New License

Facebook has launched React 16, the latest version of its popular open source JavaScript library, featuring completely rewritten internals and a new license that assuages legal concerns raised under a previous license.

Besides the new core architecture codenamed "React Fiber," the rewritten library -- which basically uses the same previous API to avoid breaking changes -- features: new render types (fragments and strings); better error handling; better server-side rendering; support for custom DOM attributes; reduced file size; and more.

One thing it doesn't feature is asynchronous rendering support, although asynchronous programming is becoming more common in the latest JavaScript implementations (such as async/await in ES7).

Although asynchronous rendering support is built into the new library, its implementation is lagging.

"The new implementation is designed from the ground up to support asynchronous rendering, which allows processing large component trees without blocking the main execution thread," Facebook engineer Sophie Alpert said in a blog post yesterday.

However, later on, she said: "Even though React's new core is designed to support asynchrony, we're currently running React in a synchronous mode compatible with our older code. This allowed us to move to the new implementation smoothly. As with most of our releases, we've been testing the new code in production for months so we feel optimistic that people will be able to adopt it without running into issues."

In a different blog post, Facebook's Andrew Clark noted that async rendering was a priority item, and pointed to a demo that showed its functionality.

"Perhaps the most exciting area we're working on is async rendering -- a strategy for cooperatively scheduling rendering work by periodically yielding execution to the browser," Clark said. "The upshot is that, with async rendering, apps are more responsive because React avoids blocking the main thread."

Facebook's isfiberreadyyet.com Site Tells the Story
[Click on image for larger view.] Facebook's isfiberreadyyet.com Site Tells the Story (source: Facebook)

Furthermore, Clark said: "We think async rendering is a big deal, and represents the future of React. To make migration to v16.0 as smooth as possible, we're not enabling any async features yet, but we're excited to start rolling them out in the coming months. Stay tuned!"

However, such innovations were nearly eclipsed by a licensing issue that threatened to derail the project, prompting developers and companies to rethink their use of the popular JavaScript UI library. The issue concerned a "BSD + Patents" license that Facebook attached to React, but which was rejected by the Apache Software Foundation, putting further use of React in legal limbo and scaring many away with the threat of lawsuits. You can read the details here, but the upshot is that Facebook changed its mind and relicensed the project with an MIT license just before React 16 launched.

Now that the legal problems are gone, and React 16 is ready for production use, developers everywhere can get back to Web programming.

React 16 can be installed via the npm node package manager registry and can be installed with Yarn, or via UMD builds supplied by a CDN. The source code is available on GitHub. Any apps that work with React 15.6 should run fine, Clark said. Interested developers can read Clark's post for details on the new features, the small number of breaking changes and other details.

About the Author

David Ramel is editor in chief of Visual Studio Magazine and Application Development Trends Magazine.

Featured

Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.