I can console.log()
the data I want after mapping through my data from my GraphQL query. However, the nested .map
functions are not rendering my JSX. Is it possible to render JSX in nested .maps
?
const NikonGallery = ({ data }) => {
return (
<Layout>
{data.allFiles.nodes.map((item) => {
Object.entries(item).map(([key, value]) => {
value.map((image) => {
console.log("Individual image", image) // Logs show the data I want
return (
<>
<GatsbyImage
image={image.gatsbyImageData}
alt={image.description}
/>
</>
)
})
})
})}
</Layout>
)
}
export default NikonGallery
The data from GraphQL/Contentful is a nested array of objects. I'm having trouble getting the JSX to render when I call the nested objects via .map
.