Hoi, I want to render one div per firestore entry and pass the string stored there as h1.
The forEach works in console.log, but I get the error:
"Objects are not valid as a React child (found: [object Promise])."
Have tried around a lot now without success.
Can someone show me how to output this correctly? Thanks!
const docRef = collection(db_firestore, "student@test.de AND otherstudent@test.de");
const q = query(docRef, where("name", "!=", ""));
async function getUsers() {
const querySnapshot = await getDocs(q);
return ( <
div > {
querySnapshot.forEach((doc) => {
<
h1 > {
doc.data().msg
} < /h1> / / < -error
{
console.log(doc.id, " => ", doc.data());
} // <- works fine
{
console.log(doc.data().msg)
} // <- works fine
})
} <
/div>
)
}
return ( <
div className = "main-class" > {
getUsers()
} <
/div>
)
}
export default ChatContacts;