arrow function doesnt get binded with this.previous
sirpy opened this issue · comments
sirpy commented
When using an arrow function:
(userId,doc..) => {}, this.previous is not defined
function(userId,doc...) {} works just fine
Simon Fridlund commented
Yeah, that's how arrow functions work... Arrow functions don't have their own this
and can't be given (bound) a new this value, it always uses the this
in the context of where it was defined.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
Here you can read up on arrow functions.