reactjs / react-rails

Integrate React.js with Rails views and controllers, the asset pipeline, or webpacker.
Apache License 2.0
6.75k stars 757 forks source link

Can not use arrow functions in component #585

Closed axhamre closed 8 years ago

axhamre commented 8 years ago

I am using es6 syntax. When I try to include an arrow function in my component, Rails throws me this error:

ExecJS::RuntimeError in Posts#show

For the sake of comparison and clarity I'm using a code example taken from babeljs.io

class PostInfo extends React.Component {
  handleOptionsButtonClick = (e) => {
    this.setState({showOptionsModal: true});
  }
}

Any help on why this occurs would be much appreciated!

rmosolgo commented 8 years ago

ES7 property initializers

I'm guessing those aren't enabled by default, since they're in a "far-future" JS version!

possible duplicate https://github.com/reactjs/react-rails/issues/562