Support for the experimental syntax 'classProperties' isn't currently enabled
First install the: @babel/plugin-proposal-class-properties as dev dependency:
npm install @babel/plugin-proposal-class-properties --save-dev
Then edit your .babelrc so it will be exact like this:
{ "presets": [ "@babel/preset-env", "@babel/preset-react" ], "plugins": [ [ "@babel/plugin-proposal-class-properties" ] ]}
.babelrc file located in the root directory, where package.json is.
Note that you should re-start your webpack dev server to changes take affect.
Solution for webpack project
I just solve this problem by adding @babel/plugin-proposal-class-properties
into webpack config plugin.The module section of my webpack.config.js
looks like this
module: { rules: [ { test: path.join(__dirname, '.'), exclude: /(node_modules)/, loader: 'babel-loader', options: { presets: ['@babel/preset-env', '@babel/react',{ 'plugins': ['@babel/plugin-proposal-class-properties']}] } } ]}