Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 472 Bytes

use-window-scroll.mdx

File metadata and controls

20 lines (14 loc) · 472 Bytes

import { HooksDemos } from '@docs/demos'; import { Layout } from '@/layout'; import { MDX_DATA } from '@/mdx';

export default Layout(MDX_DATA.useWindowScroll);

Usage

use-window-scroll returns current scroll position and a function to scroll smoothly to given position:

Definition

function useWindowScroll(): readonly [
  { x: number; y: number },
  (position: { x?: number; y?: number }) => void,
];