I have problem with babel transform. After add handle event in my React container i got this error.
SyntaxError: Missing class properties transform.
21 | // handlers
22 |
> 23 | onIncrement = () => {
| ^
24 | const { dispatch } = this.props;
25 |
26 | dispatch(valueDecrement())
My .babelrc
{
"presets": [
[
"@babel/env",
{
"targets": {
"browsers": [
"last 2 versions"
]
}
}
],
"@babel/react",
"@babel/typescript",
],
}
My webpack loader
...
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
],
},
...
Solve. Need to install @babel/plugin-proposal-class-properties and add this plugin to the .babelrc. Link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With