Dubbed “React Fiber” during its development, React 16 is a rewrite of the React core, improving perceived responsiveness for complex applications via a new reconciliation algorithm.
Key features of the React 16 include:
- Errors that feature a component stack trace to make them easier to debug.
- Returning of strings/arrays directly from component render methods.
- A new faster, streaming server-side renderer.
- More native-like application performance.
- The shift from the controversial BSD + Patents license to the more-palatable MIT license.
Promised for a later version of React 16 is asynchronous rendering, enabling processing of large components without blocking the main execution thread. The first version of React 16 released today focuses on compatibility with existing apps, and so does not include the async capabilities.
Although React’s internals have been completely rewritten in React 16, the public API is “essentially unchanged,” said Sophie Alpert, Facebook’s engineering manager for React. The intent was to save developers from having to rewrite existing components built with React.
React 16’s new code was written alongside old code in the GitHub repo, as per a familiar practice at Facebook. Switches between the two were done with the Boolean
useFiber feature flag. The process let Facebook start building its new implementation without affecting existing users and continue to make bug fixes to the old code base.
After a few months of ironing out bugs, Facebook opted to deliver a single product to reduce the possible set of bugs, rather than keep two versions of React current.