React Smooth Scroll But Not On Init

  css, javascript, progressive-web-apps, reactjs, web

I’m building a chat app using ReactJS. In Skype or WhatsApp, we see that if we click on a chat, it loads from the last. However, I want to add this feature to my app.

I came up with the solution scrollIntoView({ behaviour: "smooth" }) method. But if I click on a chat, it scrolls all the way down to bottom. But I want it already scrolled to bottom on mount.

Can you please give me any suggestion on this?

Source: Ask Javascript Questions

LEAVE A COMMENT