How do you retrieve pageYOffset from a ref? When I try this, it comes back undefined.
edit: (this is using the useRef hook and a functional component) codesandbox URL: https://codesandbox.io/s/prod-silence-8f07c?file=/src/App.js
//button to get offset
<button style={{position:"fixed", top:"200px", right:"300px"}}
onClick={() =>{
console.log(refTwo.current.pageYOffset)
}}> test</button>
....
<div ref={refTwo} className={two}> hello </div>
(Preferably not scrollY as I dont want to see how much has been scrolled, and page changes sometimes start people at halfway down the page.)