title: window.onpopstate - do I need to remove this event handler?
body: <p>I'm using <code>window.onpopstate</code> event handler to listen for back and forward browser button events. My code looks something like this: </p>
  
  <pre><code>componentDidMount() {
      window.onpopstate = this.onBackOrForwardButtonEvent;
  }
  
  onBackOrForwardButtonEvent = (e) =&gt; {
      e.preventDefault();
      log.info('back or forward button pressed');
      if (this.props.route.path !== '/app') {
         // ... do something
      }
  };
  </code></pre>
  
  <p>My question is: Do I need to remove this event listener - perhaps in <code>componentWillUnmount</code>?</p>
  
  <p>something like:</p>
  
  <pre><code>componentWillUnmount() {
      window.removeEventListener('onpopstate', this.onBackOrForwardButtonEvent, false)
  }
  </code></pre>
  
  <p>I've seen examples using <code>onPopState</code> like I have above but never with removing the listener when the component unmounts.</p>
  
  <p>example: <a href="https://github.com/ReactTraining/react-router/issues/967" rel="noreferrer">https://github.com/ReactTraining/react-router/issues/967</a></p>