Here's my problem:
getPlaceNames(){
var places = [];
var source =firebase.database().ref(`${this.props.countryProp}/${this.props.cityProp}`);
source.on('value', function(snapshot){
for (var key in snapshot.val())
places.push(key);
});
console.log(places);
return places;
}
So what's happening is that places
still ends up as an empty array after the loop is done. What exactly is happening here and how do I fix it ?