Skip to content

Can not use arrow functions in component #585

@axhamre

Description

@axhamre

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions