On Fri, May 5, 2017 at 6:49 PM, Brian Ninni <[email protected]> wrote:
> I think it might be problematic, since (if it works the same way as arrow > functions currently do) 'this' will refer to the context in which the class > was defined, and not to the instance that the function is attached to. > Not if we make it consistent with [public class fields]( https://tc39.github.io/proposal-class-public-fields/) (and we'd want to). Within the `class` structure, `this` refers to the instance (in that proposal at least). Which is consistent with method syntax and Serghei's suggestion here. This is in significant use in the React community already, via transpiling, e.g. this works: ```js class Widget extends React.Component { handleClick = _ => { this.setState(state => ({counter: state.counter + 1})); }; render() { return <div onClick={this.handleClick}>{this.state.counter}</div>; } } ``` The public class fields stuff also weakens the case for Serghei's concise method syntax, since you can do the above. -- T.J. Crowder
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

