React 16.6: What’s New?

React is a well-known JavaScript library for building user interfaces. It has been operating in the market since 2013 and it is officially recognized as a Facebook Open Source solution.

Not so long ago, a new version – React 16.6 was released. It enables multiple useful features: a PureComponent/shouldComponentUpdate form was provided for function components, the code splitting is possible to do using Suspense now. In addition to this, a Context from class components consumption has become smoother.

The list of updates introduced in the React 16.6. is even larger, but we will touch upon the most important ones in this article.

  • Now programmers can do modifications not only with class components using PureComponent or shouldComponentUpdate, but also with function components by wrapping them in React.memo.
  • A new possibility to use Suspense component for code-splitting by wrapping a dynamic import in a call to React.lazy() has arrived. Moreover, the library authors are allowed to build data retrieving with Suspense support in the future.
  • The Legacy Context API was replaced with official Context API even in the earlier version, however a new convenience API was added now to consume a context value from within a class component.
  • Static getDerivedStateFromError() was added to let developers render the fallback UI before the render completes.
  • Two more APIs were added to the list of deprecated APIs in StrictMode. If a developer doesn’t use a StrictMode – it’s ok; that warning won’t affect him/her.

Here’s the update’s full changelog:

React 16.6 has both major and minor updates and it is focused on helping developers create powerful and stable applications. The recent version shows the significant progress in the library development and keeps community expecting something more resourceful from version 16.7. There is in the wind that Hooks will be added in a new version which allows developers use state and other React features without writing a class. Nevertheless, we have already been satisfied with the recent updates and waiting to see what else the future holds for React.

The source: