stylesuxx / generator-react-webpack-redux

React Webpack Generator including Redux support
Other
552 stars 85 forks source link

Error when creating ES6 functions #86

Open codestitch opened 7 years ago

codestitch commented 7 years ago

Hi. I am writing functions inside the component class in my react js project. when I write like this function:

saySomething = (something) => { console.log(something); }

an error occurs.

screen shot 2017-07-05 at 5 53 02 pm

What should I do?

Thank you.

akhilpanchal commented 6 years ago

You can fix this by installing the babel-plugin-transform-class-properties package and adding it to your conf/webpack/Base.js Ref: https://stackoverflow.com/questions/42063854/arrow-function-syntax-not-working-with-webpack?answertab=active#tab-top