v6.0.0
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} />;