Just upgraded a project to React 17
Just upgraded a project to React 17. Importing React is no longer required in React 17, so I used this react-codemod command to remove unnecessary React imports:
npx react-codemod update-react-imports
This removed/refactored over 300 imports with a single command! 😎
#reactjs
Clarifications:
1. In React 17, The React import can only be omitted if you’re just using JSX. You still need to import React in files that use Hooks.
2. react-codemod is smart enough to do #1 for you.
3. In the new create-react-app, Babel is configured for all this to work.