UNPKG

daily-toolset

Version:

A lightweight, versatile collection of TypeScript utility functions for everyday development needs. Simplify and streamline your Node.js, React, and Next.js projects with a powerful suite of well-organized helpers for strings, arrays, dates, objects, and

20 lines (19 loc) 529 B
/** * A hook that returns the current window scroll position and a function to * scroll to the given x and y coordinates. * * @returns {Array} A tuple with the current scroll position and a function to * scroll to the given x and y coordinates. * @example * const [scroll, scrollTo] = useWindowScroll(); * * // scroll to the top of the page * scrollTo({ x: 0, y: 0 }); */ export declare function useWindowScroll(): readonly [{ x: number; y: number; }, ({ x, y }: { x: number; y: number; }) => void];