javascript - React: [useRef, scrollIntoView,] How to only autoscroll a specific div inside of an overflowing page? - Stack Overflow

PHOTO EMBED

Thu Jul 29 2021 14:57:27 GMT+0000 (Coordinated Universal Time)

Saved by @davidTheNerdy #javascript #useref

   messagesRef.current.scrollIntoView({
      behavior: "smooth",
      block: "nearest",
      inline: "start"
    });
content_copyCOPY

scroll into view

https://stackoverflow.com/questions/60289640/react-useref-scrollintoview-how-to-only-autoscroll-a-specific-div-inside-of