Nuxt3 config for GraphQL queries using separate *.gql files

Nuxt3 config for GraphQL queries using separate *.gql files


0

When searching for tutorials on how to perform GraphQL queries in Nuxt 3, I noticed that the query itself is always inside the component where it should be used. Wouldn’t it be much cleaner to store the queries in separate .gql files and use them in components? So far, I haven’t found a corresponding tutorial.

Furthermore, I’m not sure whether it is sufficient to use the useFetch composable in Nuxt 3 or if I need the nuxt-apollo module.

At the end of the day, I want to be able to perform GraphQL queries to a headless WordPress API.


Load 5 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *