When i change a function draw(){ //} to draw = () => { // }
I am getting an error like \"Uncaught SyntaxError: Unexpected token =\".
What may be
You will need to use babel's Class properties transform, which will transpile:
class Picture {
draw = () => {
console.log('drawing')
}
}
into:
class Picture {
constructor() {
this.draw = () => {
console.log('drawing');
};
}
}
You can try it in this repl (make sure to enable the class properties transform plugin)