title: How to get scroll Position in reactjs when click on button
body: <p>As you can see it I am not able to scroll down the page when I click on the button, This all code running in one file in App.js
  <br>
  Even I tried with useRef() and UseState() also but not working
  <br>
  I need help in JavaScript logic only
  <br>
  <strong>Javascript:</strong></p>
  <pre><code>const myFunction = () =&gt; {
          const element = document.getElementById(&quot;myDIV&quot;);
          element.scrollLeft = 50;
          element.scrollTop = 10;
      };
  </code></pre>
  <p><strong>HTML:</strong></p>
  <pre><code>&lt;div
      id=&quot;myDiv&quot;
      style={{ height: &quot;250px&quot;, width: &quot;250px&quot;, overflow: &quot;auto&quot; }}
  &gt;
          &lt;div
                  id=&quot;content&quot;
                  style={{
                  height: &quot;800px&quot;,
                  width: &quot;2000px&quot;,
                  backgroundColor: &quot;coral&quot;,
              }}
          &gt;
          &lt;button onClick={myFunction}&gt;Scroll&lt;/button&gt;
          &lt;p&gt;Some text inside a div element.&lt;/p&gt;
          &lt;p&gt;Some text inside a div element.&lt;/p&gt;
          &lt;p&gt;Some text inside a div element.&lt;/p&gt;
          &lt;p&gt;Some text inside a div element.&lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>