title: scroll to element on reload page react
body: <p>I'm trying to figure out how to scroll to the element after page reloads. I'm trying to <code>ref</code> the element and scroll to it after page reloads.</p>
  
  <p>My current example will just scroll to the end of the page</p>
  
  <pre><code>const transactionRef = useRef(null)
  const scrollToElemet = () =&gt; {
      transactionRef.current.scrollIntoView({ block: 'end', behavior: 'smooth' });
    }
  
    useEffect(scrollToElemet)
  
  return (
    &lt;div ref={transactionRef}&gt;&lt;/div&gt;
  )
  </code></pre>
  
  <p>How can I calculate the position of the element and scroll to it on page reload? Thanks</p>