title: React — onScroll listener for parent element?
body: <p>How can I add an onScroll listener in a component to catch a scroll of a parent element?</p>
  
  <pre><code>class ChildDiv extends React.Component {
    constructor() {
      super();
    }
    handleScrollOfParent() {
      // do stuff when parent &lt;main&gt; scrolls;
    }
    render() {
      return (
        &lt;div id="child" onScroll={this.handleScrollOfParent.bind(this)}&gt;
          // content with overflow: hidden and scroll handled by parent MAIN.
        &lt;/div&gt;
      )
    }
  }
  export default ChildDiv;
  </code></pre>
  
  <p>Rendered in a parent main, like this <code>&lt;main&gt;&lt;ChildDiv /&gt;&lt;/main&gt;</code> and I want to catch the scroll of the main.</p>