Arrow Function syntax not working with webpack?

后端 未结 5 768
渐次进展
渐次进展 2020-11-28 11:10

I\'m making an app on react-redux. I\'m using webpack for bundling and babel for transpiling. When I am try to use arrow function in my code. It gives me error as :

5条回答
  •  旧巷少年郎
    2020-11-28 11:54

    First you needed to edit the .babelrc file to

    {
     "presets": ["react", ["es2016"]],
     "plugins": [
         "babel-plugin-transform-class-properties"
      ]
    }
    

    Second npm install babel-plugin-transform-class-properties and babel-preset-es2016

提交回复
热议问题