React 17: Update All the Imports Using Only ONE Command

React 17: Update All the Imports Using Only ONE Command

As you probably know, React.js just had a new release the new version 17.0.0+. Although there are no new features, something I've been already testing is the new JSX Transform and how it affects a lot your application. So, in this article, I'll show just ONE command to update all the imports and explore this new version.

Why

In particular, React 17 is a “stepping stone” release that makes it safer to embed a tree managed by one version of React inside a tree managed by a different version of React. It also makes it easier to embed React into apps built with other technologies.

As I wrote in the beginning, there are no new features, but this version is already focusing on upgrade the experience of React as a whole, preparing for the v18.

Pre-requirements

DependencyVersion
create-react-app4.0.1+
React.js17.0.1+
React DOM17.0.1+
React Scripts4.0.1+

How

React-Codemod is a collection of Codemod scripts and is used with jscodeshift, specifically created to update React APIs.

npx react-codemod update-react-imports

<EM /> | Python and Front-End Developer

Thank you for reading this article! And if you want to be updated with the best content, subscribe to my newsletter and see you in the next one.