title: ReactJS - How to use 'ref' property for scrollbar?
body: <p>In react "^15.4.1", I want to display middle section of a page after reload. So I am trying to do it using scrollbar but I am getting an error like,</p>
  
  <pre><code>main.js:43122 Uncaught TypeError: Cannot read property 'scrollTop' of null
   at ref (main.js:43122)
   at detachRef (main.js:82172)
   at Object.ReactRef.detachRefs (main.js:82227)
   at Object.receiveComponent (main.js:10145)
   at ReactCompositeComponentWrapper._updateRenderedComponent (main.js:77618)
  </code></pre>
  
  <p>Importing like, <code>import { Scrollbars } from 'react-custom-scrollbars';</code> and the version is <code>4.0.1</code></p>
  
  <p>In .jsx file,</p>
  
  <pre><code>componentDidMount() {
    this.scrollTop(200);
  }
  
  handleScrolling = (frame) =&gt; {
   if(frame.top === 1) this.setState({ loading: true })
  }
  
  scrollTop = (value) =&gt; {
    if(this.refs.scrollbar) this.refs.scrollbar.scrollTop(value);
  }
  
  &lt;Scrollbars
      ref={(scrollbar) =&gt; {scrollbar.scrollTop(200);}}
      style={{ height: '100vh' }} onScrollFrame={this.handleScrolling}&gt;
      ...
  </code></pre>
  
  <p>How can I fix this issue? Actually I am new to ReactJS. Please help me regarding the same.</p>