From 9aa26a96af05e90c12d38ee0df2fd82acffda2ed Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Fri, 29 Nov 2019 16:11:54 +0100 Subject: [PATCH] docs: useQuery intro improvements --- packages/docs/src/guide-composable/query.md | 28 +++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/docs/src/guide-composable/query.md b/packages/docs/src/guide-composable/query.md index d6d7a8a..bcc6267 100644 --- a/packages/docs/src/guide-composable/query.md +++ b/packages/docs/src/guide-composable/query.md @@ -1,18 +1,6 @@ # Queries -The main composition function used to execute queries is `useQuery`. In your component, start by importing it: - -```vue - -``` +Fetching data involves executing **queries** using standard GraphQL documents. You can learn more about queries and GraphQL documents [here](https://graphql.org/learn/queries/) and [practice running queries in the playground](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#features). ## Executing a query @@ -33,6 +21,20 @@ query getUsers { It's recommended to give a name to your GraphQL operations (here `getUsers`), so it's easier to find them in the Apollo Client devtools. ::: +The main composition function used to execute queries is `useQuery`. In your component, start by importing it: + +```vue + +``` + You can use `useQuery` in your `setup` option by passing it a GraphQL document as the first parameter and retrieve the query `result`: ```vue{3,7-16}