Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation

Viewed 5532

In a .babelrc file, I wrote :

"plugins": [
    [
      "@babel/plugin-proposal-class-properties"
    ]
  ]

In my class, I wrote :

class Login extends React.Component {
    constructor(props){
        super(props);
        this.state={
            ...
        };
        this.changeValue=this.changeValue.bind(this);
        ...
    }
    changeValue = (e) => {
        this.setState({[e.target.name]: e.target.value});
    };
    ...

But when I try to import this module, I get :

Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.

I don't want to use webpack, it seems very complicated. If there is no other way than webpack, then how should I configure it ?

Complete project : https://github.com/maifeeulasad/react-mua-login

0 Answers
Related