I am listening for change on a file input, and I need to remove the listener after it has 'heard' something, each time.
The problem is that with a named function (can't remove listeners on anonymous functions) I lose context, and therefor cannot access state. Here's a basic version:
$ImgEl.on('change', () => {
  const reader = new FileReader();
    reader.onloadend = (e) => {
        // Do some stuff with state
        this.state.whatever;
    }
}
Utilizing this code with arrow functions, I maintain context and hence access to my state. However, if I go with a named function, I gain the ability to remove the listener, but I lose context.
Anyone else dealt with this already?
 
    