React, the open source project originated by Facebook, debuted with a new approach to Web development, subsequently carried over to React Native for mobile app development.
As the UI library improved, the leap from version 15.x to 16 involved a complete rewrite, nicknamed React Fiber.
"It improves perceived performance and responsiveness for complex React applications," Lin Clark said in introducing React Fiber at the ReactConf in March.
There has been little official documentation about Fiber, and news about it finally being ready came simply from the isfiberreadyyet.com Web site, which now proclaims, "Yes. Try the RC!" According to that GitHub issue page, version 16.0.0-rc.3 was released last Thursday.
The GitHub issue page explained what React 16 means to developers:
"React 16 is the first release that ships with a rewrite of the React core (previously codenamed 'Fiber”). This rewrite had a few goals:
This initial React 16.0 release is mostly focused on compatibility with existing apps. It does not enable asynchronous rendering yet. We will introduce an opt-in to the async mode later during React 16.x. We don't expect React 16.0 to make your apps significantly faster or slower, but we'd love to know if you see improvements or regressions.
- Remove old internal abstractions that didn't age well and hindered internal changes.
- Let us ship some of the most requested features like returning arrays from render, recovering from component errors, and readable component stack traces for every error.
- Enable us to start experimenting with asynchronous rendering of components for better perceived performance.
However, there was muted reaction to the news among some developers, because of licensing concerns.
Brought on by a change made by the Apache Software Foundation (ASF) concerning the categorization of React's BSD + Patents license, the issue is a complicated one, which Facebook attempted to explain in an Aug. 18 post. It concerns a clause in a patents license grant Facebook attached to its BSD license, which resulted in what's called the BSD + Patents license. The patent grant clause basically said users couldn't sue Facebook for patent infringement if they used the software. That led the ASF to say software under the Facebook BSD + Patent license couldn't be used in Apache products, which presents a problem to some companies -- though others are apparently okay with it.
The issue put Facebook at odds with the ASF and led many developers to ask Facebook to relicense its open source wares so they didn't have to rewrite a lot of code that can't be used the same way it once was. But Facebook didn't budge.
"We appreciate all the issues that have been opened asking questions and engaging us," Facebook's Adam Wolff said in last month's post. "We have considered possible changes carefully, but we won't be changing our default license or React's license at this time. We recognize that we may lose some React community members because of this decision. We are sorry for that, but we need to balance our desire to participate in open source with our desire to protect ourselves from costly litigation. We think changing our approach would inhibit our ability to continue releasing meaningful open source software and increase the amount of time and money we have to spend fighting meritless lawsuits."
Thus, the reaction to React 16/Fiber finally being ready for release was muted on some venues, like the Reddit social forum for developers. There, in the "reactjs" section, the first comment about the announcement, posted just yesterday, reads: "well my company is shying away from react now...this is sad."
When asked why, the developer attributed the reason to "some open source issue" the developer's company had, and another reader chimed in that in theory the issue "can make it much much harder for us to sue Facebook if they copy any of our patents."
But another reader disagreed with that charactrization: "No, it doesn't make it harder, it makes your company open to a counter-suit from Facebook. You can even continue using React and file a lawsuit. But the moment you do that you lose patent protection from Facebook.
"If there were any real risks involved in this, the legal teams at Google, Microsoft and Amazon wouldn't ever allow React. Yet all 3 of them do, and it's because Facebook modified the patent grant that allowed the lawyers at the other big 3 to start utilizing it. We use it extensively at Amazon."
Thus the rest of the discussion was dominated by licensing talk, with little attention paid to the technical merits of the new release.
About that, there is still little to found officially.
Facebook has recently published blog posts about error handling and dealing with unknown DOM attributes in React 16, but there's been no new post to confirm the isfiberreadyet.com "announcement."
In the GitHub issue announcing RC status, some breaking changes and known issues are listed along with "Points of Interest" that include:
- This is a complete rewrite of React but we expect it to work with your existing code. If you fixed all deprecation warnings introduced in 15.x, the 16 beta should work for you.
- Third party libraries that relied on deprecated or unsupported APIs may need updates to work correctly with this new release. Now is a good time to file issues against libraries that have problems. (And tell us if we broke something!)
- We are particularly interested in hearing about performance differences you notice between 15.x and 16.x. We don't expect any massive changes but would love to know about improvements or regressions. Please report them here!
- The server renderer has been completely rewritten, and now offers a streaming mode (ReactDOMServer.renderToNodeStream() and ReactDOMServer.renderToStaticNodeStream()). Server rendering does not use markup validation anymore, and instead tries its best to attach to existing DOM, warning about inconsistencies. And there is no data-reactid anymore! This server renderer code is still very new, so it is likely to have issues. Please report them.
- Hydrating a server rendered container now has an explicit API. Use ReactDOM.hydrate instead of ReactDOM.render if you're reviving server rendered HTML. Keep using ReactDOM.render if you're just doing client-side rendering.
- React Native follows a different release cycle and will update to the beta in a future release. (It's already using an alpha release but not yet using Fiber.)
Interested developers can read more about the rewrite in this "React Fiber Architecture" page.
David Ramel is editor in chief of Visual Studio Magazine and Application Development Trends Magazine.