how to get a top location of element on scroll in react code example Example: check scroll top height in react js console.log(window.pageYOffset)