Skip to main content
useScrollTop Hook
Diego Muralles avatar
Written by Diego Muralles
Updated over a week ago

Track how much the page has scrolled down relative to the top of the view port.


const scrollTop : number = useScrollTop(asPercentage?:boolean);


import { useScrollTop } from 'vev';

export default function () {
return (
<h1> Scroll Top (pixels): { useScrollTop() } </h1>
<h1> Scroll Top (percentage): { useScrollTop(true) } </h1>

Did this answer your question?