Ive been having a problem with my react app, I'm trying to map out a array ive created when data is pulled in through google firebase, the array seems to be fine as I can access it using console.log but when I go to map out the array it doesn't seem to return the title or anything, some fresh eyes would be great to look at this many thanks.
const posts = [];
const postCollection = db.collection('posts').get().then(snap => {
snap.forEach(doc => {
posts.push(doc.data());
})
});
console.log(posts);
function Content() {
return (
<div>
{posts.map(post => {
return <p key={post.id}>{post.title}</p>;
})}
</div>
);
}
Screenshot of the array:
Any help would be much appreciated.