React v16.0 comes with some major changes and an update to the react core algorithm. With React v16.0 Facebook has completely revised the internals of React while keeping the public API essentially the same.
A brief introduction of the changes are:
- New Core Architecture:React 16 is the first version of React built on top of a new core architecture, which is named “Fiber”. The new features in React v16.0 i.e. error boundaries, fragments, portals and async rendering (which is to be released soon) have been made possible due to Fibe
- Fragments & Strings:With this new feature in React v16.0 now we can also return an array of elements, and string from component’s render method.
- Error Handling:Prior to React v16.0, any error in any part of the UI would crash the whole application. To tackle this problem, a new concept has been introduced in React v16.0 namely Error Boundary.Only class components can be error boundaries. To make class components an error boundary we define a new lifecycle method called componentDidCatch(error, info).Now you can use this Error Boundary as a regular component.
- Portals:With this new concept of portals React v16.0 allows us to render children in any DOM node regardless of its location in the DOM.
- Server Side Rendering:React v16.0 includes a completely rewritten server render. It’s really fast. It supports streaming, so you can start sending bytes to the client faster. I don’t know much about server side rendering but I can refer you to this amazing article for an in-depth introduction to server side rendering in React v16.0.