2 ms·
I got to use bind for a class based event handler, using arrows would bind this to the wrong context.. but maybe I'm doing it wrong.
by agumonkey 5y ago
I got to use bind for a class based event handler, using arrows would bind this to the wrong context.. but maybe I'm doing it wrong.
- have_faith 5y agoI've used this syntax which auto-binds this, worked for me class Thing { method1 = () => {} method2 = () => { something.addEventListener('click', this.method1); } }
- agumonkey 5y agoFun trick. A bit tangled though