Facebook performs successful license surgery on React, GraphQL
Feared patent bomb defused, for the time being
As promised last week, React 16 underwent licensing replacement surgery to remove Facebook's controversial BSD + Patents license and replace it with the more welcome MIT license.
The operation was deemed necessary because, as Facebook engineering director Adam Wolff put it on Friday, the social network had failed to convince the developer community that its BSD + Patents license was compatible with open source requirements.
GraphQL, which exists as a specification that's available for implementation, has also been revised. The specification has been put under the Open Web Foundation Agreement (OWFa) v1.0 and Facebook's GraphQL implementation is now available under the MIT license.
WordPress has adverse reaction to Facebook's React.js licenceREAD MORE
But don't celebrate prematurely. Stephen O'Grady, founder of consultancy RedMonk, suggests that Facebook's decision to adopt the MIT license – which doesn't include a patent grant – rather than the Apache license – which includes a weaker patent provision than the original BSD + Patents license – solves one patent issue while raising another.
"The problem is that by choosing this approach, Facebook does not convey with the MIT license any patent grants as they would have under the Apache," he wrote in a blog post on Tuesday.
"If Facebook has patents that read on React, in other words, users of that software are not given an explicit license to them via MIT, only an untested implicit license."
React 16, among the most widely used libraries for creating user interfaces for web applications, also benefits from a code transfusion: Much of the library has been rewritten.
'Designed from the ground up'
Facebook software engineer Sophie Alpert describes the revision process as akin to swapping out the engine on a running car, given that hundreds of companies rely on React components in their web applications and Facebook did not want to ask everyone to write their React code in response to changes.
There are some breaking changes, but Facebook contends that these affect uncommon use cases and should not affect most apps.
"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," said Alpert in a blog post.
"We also took the opportunity to build frequently requested features that were previously difficult to add, like catching exceptions using error boundaries and returning multiple components from render."
Server-side rendering in React 16 is significantly faster than previous versions. Tests conducted by Sasha Aickin, former CTO of Redfin, show a 2.4x improvement using Node 4, a 3x improvement in Node 6 and a 3.8x improvement in Node 8.4.
Beyond the additions mentioned by Alpert, React 16 has gained some other new tricks, including:
- The ability to return an array of elements from a component's render method.
- More efficient generated HTML.
- Support for custom DOM attributes. ®