Skip to content

Latest commit

 

History

History
20 lines (15 loc) Β· 285 Bytes

useWindowScroll.md

File metadata and controls

20 lines (15 loc) Β· 285 Bytes

useWindowScroll

React sensor hook that re-renders on window scroll.

Usage

import {useWindowScroll} from 'react-use';

const Demo = () => {
  const {x, y} = useWindowScroll();

  return (
    <div>
      <div>x: {x}</div>
      <div>y: {y}</div>
    </div>
  );
};