I am trying to map an array inside of an array that I retrieve from firestore on the app initialization. Any ideas of what am I getting wrong? I am trying to map an inner array inside of the main array (the subarray I am trying to map is the "projects" array/object from below).
Screenshot of array that I am getting from Firestore can be found here:
I will post my code here:
<Container width="1080px">
{response.map((array) => (
<Container justifyContent="flex-start">
<Organization>
<Avatar src={avatar} />
{array.organization}
</Organization>
{response.id.projects.map((project) => (
<Project>
<Thumbnail />
<ProjectName>
<ProjectYear>2020 • </ProjectYear>
My Project Name
</ProjectName>
</Project>
))}
;
</Container>
))}
;
</Container>
This is how I fetch my data:
useEffect(() => {
firebase.db.collection('folders').onSnapshot((snapshot) => {
const json = snapshot.docs.map((doc) => ({
id: doc.id,
...doc.data(),
}));
setResponse(json);
console.log(json);
});
}, []);
