React 16 Launches with Rewritten Internals, New 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.
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."
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!"
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.
David Ramel is an editor and writer for Converge360.