Course lesson
Pass an Id in a Vue 3 app through Query Parameters to a GraphQL Query
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.
- Duration
- 4 min
- Access
- Included
- Transcript
- Retained from source evidence
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.