Simple hook that tracks scroll position
import { useScrollPosition } from 'use-haki';
const App = () => {
const scrollPosition = useScrollPosition();
return (
<div>
<span>scroll position: {scrollPosition}</span>
</div>
);
};
const scrollPosition = useScrollPosition();
- scrollPosition - gives scroll position
- scrollPosition