@tremendous/help
    Preparing search index...

    Function useInfinityScroll

    • Custom hook that triggers a callback when the user scrolls to the bottom of an element.

      This hook adds an event listener to an element that checks if the user has scrolled to the bottom. When the bottom is reached, it triggers the provided callback function.

      Parameters

      • element: null | HTMLElement

        The target element to attach the scroll event listener to.

      • dependencies: DependencyList

        A list of dependencies for the effect.

      • callback: () => void

        The function to call when the user scrolls to the bottom.

      Returns void

      const divRef = useRef<HTMLDivElement>(null);
      useInfinityScroll(divRef.current, [], () => {
      console.log('Scrolled to the bottom!');
      });