The Apollo Query component

We will start by implementing the Query component. You should be able to easily follow the instructions here, as all of the patterns and React basics should be clear by now:

  1. Create a new queries folder inside of the components folder, as follows:
mkdir src/client/components/queries
  1. The query that we want to remove from our view layer is the postsFeed query. You can define the naming conventions for this, but I would recommend using the RootQuery name as the filename, as long as it works. So, we should create a postsFeed.js file in the queries folder, and insert the following code:
export default class PostsFeedQuery extends Component {  getVariables() {    const { variables } = this.props; var query_variables = ...

Get Hands-On Full-Stack Web Development with GraphQL and React now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.