nextspace
    Preparing search index...

    Function useAutoScroll

    • Custom hook to handle automatic scrolling to bottom of messages Used by chat components to keep the latest message visible

      Type Parameters

      • T extends any[]

      Parameters

      • messages: T

        The array of messages to monitor for changes

      Returns {
          isAtBottom: boolean;
          messagesContainerRef: RefObject<HTMLDivElement>;
          messagesEndRef: RefObject<HTMLDivElement>;
          scrollToBottom: () => void;
      }

      An object containing refs and functions for managing auto-scroll behavior