title: React how to remove listners correctly in componentWillUnmount, why do I need the bind in the constructor?
body: <p>I'm a bit confused, what is the difference between this sintax:</p>
  
  <pre><code>  constructor(props) {
      super(props);
      this.state = {
        openPane: false
      }
      this.togglePaneHelper = this.togglePaneHelper.bind(this);
    }
    componentDidMount() {
      document.body.addEventListener('click', this.togglePaneHelper);
    }
    componentWillUnmount() {
      document.body.removeEventListener('click', this.togglePaneHelper);
    }
  </code></pre>
  
  <p>and this one:</p>
  
  <pre><code>  constructor(props) {
      super(props);
      this.state = {
        openPane: false
      }
    }
    componentDidMount() {
      document.body.addEventListener('click', this.togglePaneHelper.bind(this));
    }
    componentWillUnmount() {
      document.body.removeEventListener('click', this.togglePaneHelper);
    }
  </code></pre>
  
  <p>My concern is that the second syntax isn't removing correctly the listner and it cause this warning:</p>
  
  <pre><code>Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the undefined component.
  </code></pre>