My Firebase document contains a list with various properties such as name and imgUrl. Currently, I am facing an issue with extracting only the "name:" information from the list in Firebase Cloud Firestore so that I can determine how many times a specific name appears.
Here is how I retrieve the data from the document:
const matchLikes = async () => {
await fire.firestore()
.collection("eventLikes")
.doc(eventID).onSnapshot((querySnapshot) => {
//console.log("print indi event heree " + querySnapshot.data().eventID)
setLikes(querySnapshot.data().ActivityLikes)
})
I have stored the array in a hook for use, but I am struggling to access just the "name:" information within the array. I have attempted using
querySnapshot.data().ActivityLikes.name
, but it does not work as expected. Can anyone help me identify where I might be making a mistake?