I have this function here in a separate file, where:
export const getListOfChannels = (id) => {
const channels = []
firestore.collection("channels").where("channelId", "==", id).get().then(querySnapshot => {
querySnapshot.forEach(doc => {
channels.push(doc.data().id)
})
})
return channels
}
And in another file, I'm doing:
// This is returning an empty array
const returnFromFirebase = getListOfChannelsIdWithCommunityId(id)
It wasn't supposed to return an empty array, because if I do a console.log(doc.data().id) I can see the data.
Am I doing something wrong?