Or use :
myMethod = (arg) => {return this.value + arg;}
With es7.classProperties in babel.
https://babeljs.io/docs/usage/experimental/Or more tersely:
myMethod = arg => this.value + arg;or depending on what you are doing in that method, use a get myProperty() {//do stuff and return prop}
Sample code from just this afternoon:
const typeMap = {
'i-text': this.processText.bind(this),
'image': this.processImage.bind(this),
'rect': this.processRectangle.bind(this)
};
Really annoying if you ask me, though I understand why it had to be this way.
Easily "fixed" if you remember to put `.bind(this)` everywhere, though.