Create React App 4.0 is currently in alpha and supports using React 17 and the new JSX transform. To use it, follow these instructions.
Create a new app with npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app
Edit package.json in the new app and change the version numbers for react and react-dom to 17.0.0-rc.2 (the latest version of React 17 at the time of this writing). The updated versions should look like this:
"react": "^17.0.0-rc.2",
"react-dom": "^17.0.0-rc.2",Create React App's current ESLint configuration will warn you when using JSX without importing React. You can disable these rules by updating the eslintConfig section in package.json. The updated config should look like this:
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
],
"rules": {
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off"
}
},Save your changes to package.json and run either npm install or yarn.
Open src/App.js and delete the line import React from 'react' from the top of the file. Start your app (with either npm run start or yarn start) and everything should continue to work, even though you're no longer importing React!
For more information about the new JSX transform in React 17 see the post from the React Blog and the Babel release announcement.
Upgrade guide for TypeScript users:
typescript >= 4.1.0which supports the new JSX factories: https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#jsx-factoriestsconfig.json: changejsxtoreact-jsxdev(development) orreact-jsx(production)@iansu Will CRA 4.0 handle the switch from
react-jsxdevtoreact-jsxautomatically?