The array doses is the one that I wanted to retrieve, however I keep getting an error that says that map is not a function. This is what it looks like in firebase:
codes to retrieve firestore data:
useEffect(() => {
const unsubscribe = firestore
.collection("users")
.doc(scanResult)
.onSnapshot((snapshot) => {
const arr = [];
arr.push({
...snapshot.data(),
});
setUsers(arr);
});
return () => {
unsubscribe();
};
}, []);
mapping the users array:
{users && users.map((user) => (
<li>{user.email}</li> // I could already retrieve the data that are not inside the doses array
{/* get the doses array does not work */}
{users &&
users.doses.map((index) => {
<li>{index.selectedVaccine}</li>;
})}
))}
