I recommend adding a date to the messages when you push them to firebase:

const message = {
username: this.username,
text: e.target.value,
date: (new Date()).getTime()
}

And then doing this to order and limit the data you get back:

const itemsRef = fire.database().ref(‘messages’).orderBy(‘date’, ‘desc’).limit(10);

Programmer — Writer. @andyhartnett12

Programmer — Writer. @andyhartnett12