question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React 17 CRA with new JSX transform before the official v4

See original GitHub issue

Ek21mWZX0AAUT_P

If you install a new CRA and you don’t want to import React in each file right now these are the steps you need to do:

  1. delete the node_modules folder
  2. delete package-lock.json
  3. replace the existing react-scripts with “react-scripts”: “4.0.0-next.98” in package.json
  4. Replace esLintConfig with (in package.json):
 "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ],
    "rules": {
      "react/jsx-uses-react": "off",
      "react/react-in-jsx-scope": "off"
    }
  },
  1. create an .env file and add SKIP_PREFLIGHT_CHECK=true in it
  2. npm install

This is the workaround for now. Until the final v4 of CRA gets available this is what you have to do.🤠

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
iansucommented, Oct 21, 2020

The new version of Create React App hasn’t been released yet but this has already been implemented. When v4 is released this will work without you needing to do anything.

0reactions
alexdobsomcommented, Nov 25, 2020

Also, be careful to not delete the react import in index.js !

@alexdobsom but leaving it there gives me ‘React’ is defined but never used no-unused-vars

Did you do step 4?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing the New JSX Transform – React Blog
Together with the React 17 release, we've wanted to make a few improvements to the JSX transform, but we didn't want to break...
Read more >
React 17 introduces new JSX transform - Saeloun Blog
A Babel plugin called @babel/plugin-transform-react-jsx transforms JSX into standard JavaScript objects that a JavaScript engine can parse.
Read more >
Upgrade Create React App-Based Projects to Version 4 (CRA 4)
In this article, we'll use Create React App 4 (CRA 4) as an example to walk through the ... With the new transform,...
Read more >
React 17: New Features!! - JSX Transform is Amazing!!
Become A VS Code SuperHero Today: http://vsCodeHero.comAbout a month ago React 17 was announced and it seemed to be a very underwhelming ...
Read more >
React 17: New JSX Transform - In Plain English
The new JSX transform, however, no longer requires the React import. The compilation will still work without a single change to your JSX...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found