I wanted to scroll the screen to the bottom using react hook I am receiving a message array in Messages.js component and sending each message to Message.js component to load as per the user but I am unable to implement an auto-scroll to bottom. This is my code Messages.js:
import React from 'react'
import Message from './Message';
function Messages(props) {
return (
<div>
{props.messageDetails.map((message) =>
<div key={message.Time_Stamp}>
{
<Message
messageBy={message.Sender}
messageTime={message.Time}
message={message.Message}
userName={props.userName}
/>
}
</div>)
}
</div>
)
}
export default Messages