In componentWillMount I am registering an onSnapshot function which updates the state.
componentWillMount () {
todoRef.onSnapshot((doc) => {
let todos = []
doc.forEach(doc => {todos.push(doc.data())})
this.setState({
todos
})
})
}
However, the way that firebase/firestore works is that it just pushes up random keys, so when I get the data back it's not in the correct order.
I know there is a .orderByValue() function but I've tried implementing it and can't seem to figure it out.