Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Support for the experimental syntax 'decorators-legacy' isn't currently enabled

I am getting the above error when I am using mobx-react and while trying to use annotations.Here I am using .js and not .ts. All the solutions provided earlier not successful for me.

import React, { Component } from 'react';
import { withRouter, Redirect } from 'react-router-dom';
import { observable, action } from 'mobx';
import { inject, observer } from 'mobx-react';

@inject('authStore')
@withRouter
@observer
class Login extends Component {

   componentWillUnmount() {
       this.props.authStore.reset();
   }

}

My error is enter image description here

like image 414
Anuruddha Thennakoon Avatar asked Nov 23 '18 04:11

Anuruddha Thennakoon


1 Answers

If you are using babel then you need to install and use @babel/plugin-proposal-decorators with legacy mode enabled.

For example, plugins section of .babelrc:

    "plugins": [
      ["@babel/plugin-proposal-decorators", { "legacy": true }]
    ]
like image 105
Danila Avatar answered Nov 15 '22 04:11

Danila