Create and fetch single page using graphql from Wordpress with clean URLs #15816
Unanswered
yudyananda
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, i just learn Next.js in a couple of days. Right now i'm facing difficulties to find the proper way to fetch the data for a single page like
post/[slug].js
product/[slug].js
Here is my step
pages/product/[slug].js
I'm not sure if this is the proper way but with
useRouter
i manage to have clean url/product/product-name
by usinguseRouter
.The problem is how can i fetch the right product for each page. As you can see the only parameter/variable query that i have from the wordpress graphql is the
$id
Beta Was this translation helpful? Give feedback.
All reactions