I am working in a project with Next13 and i face an issue when i try to fetch prismic data, In Next13 we use the fetch api to create ssg pages, a time ago i used the code below but now i have no ideia how to make it
As shown in your other question (how to fetch only specific data from graphql query), links is an array so unless you loop through it or you access to a specific position you can't do
post.data.links.blog.document.map((test)
I guess you are trying to do this for getting solution to fetch prismic data with Graphql query and also find this topic for the solution:
post.data.links[0].blog.document.map((test)
According to links structure, it seems to be an array of 1 item.
Try to debug your loops by adding a breakpoint or console.logs before returning the JSX, so you will be able to see what you are looping through:
{
post.data.links.blog.document.map((test) => {
console.log(test);
return (
<GridPosts>
<GridPost>
<img src={Post2} alt="Post1" />
<FlexPost>
<PostTitle>TEST</PostTitle>
<PostParagraph>
A lot of different components that will help you create the
perfect look for your project
</PostParagraph>
<PostTag>Fiction</PostTag>
</FlexPost>
</GridPost>
</GridPosts>
);
});
}