Complete the code to define a fragment named 'userFields' for selecting 'id' and 'name'.
fragment userFields [1] User { id name }The keyword on is used to specify the type the fragment applies to.
Complete the query to use the fragment 'userFields' inside the 'users' field.
{ users { [1]userFields } }To include a fragment in a selection set, use the spread operator ... followed by the fragment name.
Fix the error in the fragment usage by completing the code correctly.
query { user(id: 1) { id name [1]userFields } } fragment userFields on User { email }The fragment must be included with the spread operator ... before the fragment name.
Fill the blank to define and use a fragment named 'postFields' selecting 'id' and 'title'.
fragment [1] on Post { id title } query { posts { ...postFields } }The fragment name must be consistent. Use postFields to match the usage in the query.
Fill all three blanks to create a fragment 'commentFields' selecting 'id', 'text', and use it in a query for 'comments'.
fragment [1] on Comment { [2] [3] text } query { comments { ...commentFields } }
The fragment name is 'commentFields'. Inside the fragment, 'id' and 'userId' are fields selected along with 'text'.