Using the Contentful CMS I've created a content model that allows for multiple items within a series of items. Part of the GraphQL query is as follows below:
valueContainers {
id
title
description
singularValue {
id
subValueTitle
subValueContent {
subValueContent
}
}
}
I'm able to display the titles of the top level sections (valueContainers) but I'm trying to map the singular value inner array within but I'm struggling to pass through the data. My code to map the array below is as follows:
return (
<ValuesWrapper>
{props.valueList.map((value) => (
<ValueContainer>
<ValueTitle key={value.id}>{value.title}</ValueTitle>
<ValuesDescription>{value.description}</ValuesDescription>
{value.singularValue.map((item) => (
<SingleItem key={item.id}>{item.subValueTitle}</SingleItem>
))}
</ValueContainer>
))}
</ValuesWrapper>
)
I'm getting an error message on the front end that says:
Error in function eval
Cannot read properties of null (reading 'map')