title: React.js Call function after scroll event
body: <p>I have built a React component which is suppose to call the function on window scroll event.</p>
  
  <p>I would like to call the function, "getCards('default'), when the user scroll to 90% of the scroll height.</p>
  
  <p>The component looks as shown in below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>class Home extends React.Component {
  
    constructor(props) {
      super(props);
      this.handleScroll = this.handleScroll.bind(this);
    }
  
    componentDidMount() {
      // test
      this.props.getCards('default');
      window.addEventListener('scroll', this.handleScroll);
    }
  
    handleScroll(event) {
      console.log('scroll event');
    }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Could anyone help me achieve this?</p>
  
  <p>Thank you.</p>