Trying to get single page details using wordpress and nextjs using apollo graphQL

Viewed 29

I am tryring to get single page details using wordpress and nextjs using apollo graphQL, But getting error.

Error - TypeError: Cannot read properties of null (reading 'useContext')

export async function getStaticPaths() {
const { alllPost } = useQuery(getAllPostsWithSlug);

return {
paths: alllPost.edges.node.map(({ node }) => `/posts/${node.slug}`) || [],
fallback: true,
};
}

Is anyone have same issue? Please help.

0 Answers
Related