Firebase version 9.6.9
I'm using onSnapshot function to get the data from the firestore.
Code:
const [posts, setPosts] = useState([])
useEffect(() => {
return onSnapshot(
query(collection(db, 'posts'), orderBy('timestamp', 'desc')),
(snapshot) => {
console.log(snapshot.docs)
}
)
}, [db])
snapshot.docs logs a metadata and not the data I need (the posts collection).

