August 31, 2019
Previously, I wrote about writing a GraphQL query that takes variables.
I was using this to programmatically create posts.
In returning to that post later, however, I noticed that I actually forgot a relevant detail: how to test it in GraphiQL, the playground Gatsby provides.
Continuing with the same example we used last time, you can see at the bottom left of the screen a “Query Variables” option.
Clicking on it exposes an input window.
In my case, my only variable is a string for the argument
$slug. To pass an option, I create an object with
slug as the key and whatever value I want.
Note: It’s important to put quotes around Slug or it will error.
Thanks for reading! My name's Stephen Weiss. I live in Chicago with my wife, Kate, and dog, Finn.
Click here to see the archives of my weeks in review and sign up yourself!