In this video, Eve describes how to query data that uses one or many connections. Even with nested fields, GraphQL makes one request for the data, improving performance.
- One of the most important benefits…of working with GraphQL…is the fact that in one request,…we can get all of the data that we need,…even from complex, nested fields.…Let's make our query a little bit more complicated…by adding multiple nested fields.…We'll also throw in some arguments for good measure.…So the first thing I want to do here…is query the repository fields.…And the arguments that I'll pass in here are owner,…this time we're going to use GitHub,…and then we're going to use the name…of opensource.guide.…
So the repository that I'm actually looking at…is in my other tab here.…And this is going to describe everything we need…to run a successful open source community.…Pretty cool.…So let's go ahead and add some additional fields here.…We'll add id,…name...…and description.…And then we're going to add another field here…called watchers.…So this is just going to give us…a list of users that are watching this repository.…
So this time we are going to use the argument first,…and we are going to pull the first five.…
In this course, learn how to get started with GraphQL. Eve Porcello walks through the basics of this query language, diving into the data fetching specification, and helping you get up to speed with the syntax and vocabulary of GraphQL. Eve explains how to create basic queries, including how to work with arguments and multiple fields. She also goes into complex techniques for handling data, including working with aliases, fragments, and pagination. Plus, she covers how to edit and transform data with mutations.
- Learning about the origins of GraphQL
- Learning about how GraphQL makes data fetching and updating easier
- Creating basic queries
- Using multiple fields
- Understanding schemas
- Handling data
- Drilling down into nested fields with a query
- Adding variables for argument values
- Creating mutations
- Adding a reaction mutation