In Chapter 2, A Three-Tier Web Application using REST, our React application was making API calls to our REST endpoints. This REST API that we built returns JSON, which our frontend code easily digests and feeds into our React code for rendering UI elements.
With a change to a GraphQL-based API, our frontend code will need to change somewhat drastically for the data-fetching sections. GraphQL behaves very differently than REST, and there is no corollary between a REST endpoint, which returns a known set of data, and GraphQL. Each GraphQL query is unique in that the client is responsible for asking for a specific set of data.
We won't review the changes to the frontend code. At the time of writing, popular choices for GraphQL for the frontend are Apollo and Relay. Apollo comes out of the Meteor Development Group and Facebook is behind Relay. Both...