In this video, Eve shows how to add a reaction to the comment that was added in an earlier video. Using a GraphQL mutation, see how to define the type of reaction with the data payload.
- [Instructor] Let's take a look at one more example…of mutating data in GraphQL.…This time, we're going to add a reaction.…A reaction is just one of these emojis…that you can add by clicking the + smiley face over here,…and then picking which reaction you want to add.…Now, in order to do this,…we're going to need to know the id for this comment,…so I can make sure I'm adding my reaction to the right one.…So let's first get that id by running a query.…So, in the previous video we created…this repositoryOwner query.…
This looked for an id for this particular comment,…so, actually, our work is done for us partially here.…So I'm just going to copy and paste this string…and then I've removed our query variables…from the last one, we're going to rewrite them.…So we're going to just add this as a little comment here,…so we don't lose it.…Next, we want to use the add reaction mutation,…so the add reaction mutation…is going to be one of the other ones…that comes directly from this GraphQL github API.…
So addReaction is going to take in addReaction input,…
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