React 17 makes upgrades easier
- 11 November, 2020 18:40
Unveiled October 20, React 17 enables gradual React upgrades. When moving from React 15 to React 16 or from React 16 to React 17, users usually would upgrade the entire app at once. While this works well for many apps, it can be challenging if the codebase was written more than a few years ago and was not actively maintained.
Although it is possible to use two versions of React on the same web page, this has been fragile and has caused problems with events. Many of these problems are being fixed with React 17. Thus, when React 18 and subsequent versions are published, developers will be able to upgrade an app either all at once or piece by piece.
With React 17, it becomes safer to embed a tree managed by one version of React into a different version of the library. React 17 also makes it easier to embed React into apps that were built with other technologies.
To enable gradual updates, changes have been made to the React event system; these changes are potentially breaking. AÂ FAQ has been published pertaining to stability.
In addition, React 17 introduces support for a new JSX transform, and that support is backported to older versions of React as well. The new transform is offered on an opt-in basis.
To install React 17 from NPM, you can use the following command:
npm install firstname.lastname@example.org email@example.com
From Yarn, use:
yarn add firstname.lastname@example.org email@example.com