我实际上如何在这样的侦听器中使用await?我得到await is a reserved keyword
getPosts = async () => {
return firebase.database().ref('posts/').orderByChild('created').on('value', snapshot => {
let newPosts = []
snapshot.forEach(post => {
let location = await geofire.get(post.key)
console.log("nice location", location)
newPosts.push(post)
})
this.setState({ allPosts: newPosts }, () => console.log(this.state.allPosts))
})
}