Pass an Id in a Vue 3 app through Query Parameters to a GraphQL Query

Share this video with your friends

Send Tweet

We can also make our GraphQL queries dynamic by using query parameters. In this lesson, we create a query for the CraftView page, which requires an ID that we pass through query parameters.

In our Vue app, we can dynamically pass the id into the second argument of the useQuery composable. We get the id from the route using the useRoute composable.