0

enter image description here

I want use React js+Mobx but I'm getting an error

ERROR ./src/stores/Todo.js SyntaxError: C:\Users...example path\Todo.js: Support for the experimental syntax 'decorators-legacy' isn't currently enabled (9:5):

   [enter image description here][1]

Versions "mobx": "^5.15.2", "mobx-react": "^6.1.4", "react": "^16.12.0", "react-dom": "^16.12.0",

Thanks.

Nitin Bisht
  • 5,053
  • 4
  • 14
  • 26

1 Answers1

0

You need to use the Babel plugin @babel/plugin-proposal-decorators in your babel config.

  • For this you should install it as a dependency, from npm.

npm install @babel/plugin-proposal-decorators -DE

  • Then add the following lines to your babel config under plugins.
//...
plugins: [
    [
      '@babel/plugin-proposal-decorators',
      {
        'legacy': true
      }
    ],
// ...
]

Kev
  • 5,049
  • 5
  • 32
  • 53
  • thanks . I solved the problem this way: ``` const { override, addDecoratorsLegacy, disableEsLint } = require("customize-cra"); module.exports = override( // enable legacy decorators babel plugin addDecoratorsLegacy(), // disable eslint in webpack disableEsLint() ); ``` – Ferdi Özer Mar 26 '20 at 21:24