From ecbaf058f858903d151dfcdfeb18ed591690dd77 Mon Sep 17 00:00:00 2001 From: Paul Rosset Date: Wed, 4 Apr 2018 01:17:53 +0100 Subject: [PATCH] Add new example doc: GraphQL Reference/Query Variables (#4795) * Add new example doc: GraphQL Reference/Query Variables * Update graphql-reference.md --- docs/docs/graphql-reference.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/docs/graphql-reference.md b/docs/docs/graphql-reference.md index deebc3b1dfad7..846e92a52b5f8 100644 --- a/docs/docs/graphql-reference.md +++ b/docs/docs/graphql-reference.md @@ -68,7 +68,14 @@ This query combines sorting, filtering, limiting and formatting together. ## Query variables -Work in progress - pull requests welcome. +In addition to adding query arguments directly to queries, GraphQL allows to pass in "query variables". These can be both simple scalar values as well as objects. + +The query below is the same one as the previous example, but with the input arguments passed in as "query variables". + +To add variables to page component queries, pass these in the `context` object [when creating pages](https://deploy-preview-4795--gatsbyjs.netlify.com/docs/creating-and-modifying-pages/#creating-pages-in-gatsby-nodejs). + + + ## Where next?