Querying with GraphQL

Lessons

1. Intro to GraphQL

4:42

2. Fetching data with queries

9:11

3. Improving Developer Experience

5:43

4. Query variables, handling loading and errors

6:53

5. Advanced queries

5:52

6. Updating data with mutations

13:59

7. Bonus: Q&A with Natalia Tepluhina

21:29

8. Manual cache updates and optimistic responses

12:41

9. Real-time updates with subscriptions

6:59

10. Setting up local state with Apollo Client

6:05

11. Modifying local state with Apollo Client

4:48

Manual cache updates and optimistic responses

In the previous lesson we learned how to change the data on the GraphQL server with mutations, and how they are able to automatically update the Apollo cache. Unfortunately, automatic update is not always the case. This works when we have an existing entity (in our case, it’s a Book and we update some properties of it), but what happens if we want to create a new entity and add it to the list? How do we handle Apollo cache changes and UI updates? We will answer all these questions in this lesson.


Writing a mutation to add a new book

Before we start adding any new code to our Vue application, let’s first shape a mutation to add a new book