title: window.removeEventListener with a named function isn't working
body: <p>I am using React and below is the code I am using to implement the infinite scroll feature.</p>
  <pre><code>componentDidMount() {
      // Flag to check if the content has loaded.
      let flag = true;
  
      function infiniteScroll() {
        let enterpriseWrap = $('.enterprise-blocks');
        let contentHeight = enterpriseWrap.offsetHeight;
        let yOffset = window.pageYOffset;
        let y = yOffset + window.innerHeight;
  
        console.log('hey');
  
        if(this.props.hasMore) {
  
          if(y &gt;= contentHeight &amp;&amp; flag) {
            flag = false;
  
            this.props.loadMoreVendors(function() {
              flag = true;
            });
  
          }
  
        } else {
          window.removeEventListener('scroll', infiniteScroll.bind(this));
        }
      }
  
      window.addEventListener('scroll', infiniteScroll.bind(this));
    }
  </code></pre>
  <p>I actually want to unbind the scroll event once all the items are loaded but <code>removeEventListener</code> is not working. Am I doing something wrong?</p>