qol-hooks
Version:
A collection of React hooks to improve the quality of life of developers.
21 lines (20 loc) • 402 B
TypeScript
/**
* Custom hook that tracks the scroll position of the window.
* @returns {number} The current scroll position in pixels.
*
* @example```tsx
* const Component = () => {
* const scrollPosition = useScroll();
*
* return (
* <div>
* <p>Scroll Position: {scrollPosition}</p>
* </div>
* )};
* ```
*/
declare function useScroll(): {
x: number;
y: number;
};
export default useScroll;