Have been following a post which details the steps required for setting up React with C#. However, I am being presented with the following error everytime I try to compile a React application:
Support for the experimental syntax 'classProperties' isn't currently enabled
onChange = (e) => {
this.setState({ value: parseInt(e.currentTarget.value, 10) });
};
The error message outlines:
Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation. If you want to leave it as-is, add @babel/plugin-syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing.
Therefore, I altered my package.json to suit:
{
"name": "Test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack --config=Scripts/React/config/webpack.config.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.10.3",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/preset-react": "^7.10.1",
"@babel/preset-env": "^7.2.3",
"babel-preset-react": "^6.23.0",
"babel-loader": "^8.1.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.12"
},
"dependencies": {
"react-countup": "^4.3.3",
"react-router": "^5.2.0",
"react-svg-gauge": "^1.0.10",
"reactstrap": "^8.5.1",
"recharts": "^1.8.5"
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
}
}
Despite this, I am still receiving the same error. Does anyone have any ideas as to how I can mitigate this issue?