January 2019
Intermediate to advanced
460 pages
10h 33m
English
Before inserting the GraphQL client directly into our React application tree, we should test it. This is also the next step in Apollo's official documentation. We will write some temporary code to send our first GraphQL query. After testing our GraphQL client, we will remove the code again. The easiest way to do this is to use the graphl-tag package:
npm install --save graphql-tag
import gql from 'graphql-tag';
client.query({ query: gql` { posts { id text user { avatar username } } }`}).then(result => console.log(result));
The preceding ...
Read now
Unlock full access