generator-react-webpack-redux icon indicating copy to clipboard operation
generator-react-webpack-redux copied to clipboard

Error when creating ES6 functions

Open codestitch opened this issue 8 years ago • 1 comments

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.

codestitch avatar Jul 05 '17 09:07 codestitch

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

akhilpanchal avatar Dec 17 '17 18:12 akhilpanchal