Documentation
Hooks
useScrollThreshold

useScrollThreshold

Check if the user has scrolled past a certain threshold using a given offset or handler.

This will disapears when you scroll past 160px.

Type Definitions

type ScrollThresholdHandler = (event?: Event) => boolean | undefined | null;
type ScrollThresholdOffset = {
    top?: number;
    bottom?: number;
    left?: number;
    right?: number;
};
 
const useScrollThreshold: <T extends HTMLElement = HTMLDivElement>(args: {
    threshold: ScrollThresholdOffset | ScrollThresholdHandler;
    ref?: React.RefObject<T> | null;
}) => {
    ref: React.RefObject<T>;
    isPast: boolean;
};