Use the following commands:
npm install @babel/preset-react --save-dev
Steps to Configure Babel for JSX:
Install Babel & React Preset
npm install @babel/core @babel/preset-env @babel/preset-react --save-dev
Create or Update .babelrc
{
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
Use Babel to Compile JSX
npx babel src --out-dir dist