I am trying to scroll div to button when page loaded and added a new message in the list.
but here I am getting error 'scrollIntoView' undefined.
This is my code what I have tried so far
componentDidUpdate() {
this.scrollToBottom ()
}
componentDidMount() {
this.scrollToBottom ()
}
scrollToBottom = () => {
this.messagesEnd.scrollIntoView({ behavior: "smooth", });
}
<div style={{ float:"left", clear: "both" }}
ref={(el) => (this.messagesEnd = el)}>
</div>
what Is wrong here why it is showing this error.
Your help would be highly appropriated
that.messagesEnddefined?ScrollView undefined