Problem
After I query my objects from GraphQl server, on console logging data
I get my objects in the console but when I destructure it in a way data: { getPosts : posts }
it returns a type error and when I try to map over data
only it returns data.map is not a function
The Code
const {loading, data: {getPosts: posts} } = useQuery(FETCH_POSTS); // Here is the error
return(
{loading ? (
<h1>Loading...</h1>
) : (
posts && posts.map(post => (
<Grid.Column key={post.id}>
<PostCard post={post} />
</Grid.Column>
))
)}
)