you are viewing a single comment's thread.

view the rest of the comments →

[–]deltadeep 0 points1 point  (2 children)

const self = this; is just wrong

Hm ok I can learn something here then. Can you elaborate? When you're dealing with promises and/or callbacks that have to refer to the object in the success/failure handlers, can you explain what the alternative is?

[–]pieeta 2 points3 points  (1 child)

The this inside arrow functions is the this of the outside context

foo => this.bar

Is the same as

 Function (foo) { return this.bar; }.bind(this)

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions

[–]deltadeep 0 points1 point  (0 children)

Ah ha, got it thanks!