Skip to content

v6.0.0

Compare
Choose a tag to compare
@perrin4869 perrin4869 released this 14 Mar 15:27
· 558 commits to master since this release

Replaces onScrolled with a new function returned by the hook, isScrolled. Whereas before you'd do:

useStayScrolled(ref, { onScrolled: () => console.log('Scrolled down') });

Now you do:

const ref = useRef();
const { isScrolled } = useStayScrolled(ref);

const onScroll = () => {
  if(isScrolled()) {
    console.log('Scrolled down');
  }
};

return <div ref={ref} onScroll={onScroll} />;