I am currently designing a chat bot to send messages for sales queries, I am having trouble with making it automatically scroll to the bottom of the list.
This happens instead:

Here is my code for the mapping of said messages:
<List className={classes.messageArea}>
{chatHistory.map(item => {
return (
<ListItem key={item}>
<Grid container>
<Grid item xs={12}
className={item.sent ? classes.msgsUs : classes.msgsScotti}>
<ListItemText align={item.sent ? "right" : "left"}
primary={item.text}/>
</Grid>
<Grid item xs={item.sent ? 11 : 12}>
<ListItemText align={item.sent ? "right" : "left"}
secondary={moment(item.time).format('HH:mm')}/>
</Grid>
</Grid>
</ListItem>
)
})}
</List>
How do I get it to automatically scroll to bottom when new messages are sent through, tried various methods but not accomplishing anything. Thanks for taking the time to look at this.