I want to separate class methods into their own files. For example if I have a simple class like this in test.js
:
export default class TestClass {
testFunction(...args) {
return require('./test-function').apply(this, args);
}
}
And then in test-function.js
method:
export default function() {
/* `this` keyword works fine */
}
However, if I change it to an arrow function, then this does not work anymore (because of lexical scoping?):
export default () => {
/* `this` doesn't work anymore */
}
How would I bind this
properly so my arrow test
function can use it?