How to fix “Support for the experimental syntax ‘jsx’ isn’t currently enabled” error with React?

Spread the love

To fix "Support for the experimental syntax ‘jsx’ isn’t currently enabled" error with React, we add the Babel presets to the babel.config.js file.

For instance, in babel.config.js in our project folder, we write

module.exports = {
  presets: ["@babel/preset-env", "@babel/preset-react"],
};

to add the '@babel/preset-env"' and '@babel/preset-react' presets so JSX can be parsed in the React project.

Leave a Reply

Your email address will not be published. Required fields are marked *