From the course: Learning Apollo

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Mutations with React component

Mutations with React component

From the course: Learning Apollo

Start my 1-month free trial

Mutations with React component

- [Instructor] Now that we have mutations available to us with Apollo, let's add it to a new component called addContacts. The first thing I want you to do is go inside schema, so we'll fix the little thing that we had on the last one, because right now if we add anything, it's going to add the mock data, so let's remove that function here. And let's also remove the import, we don't need it. And let's put that into a single line, it's going to make it cleaner. Remove the comma, save, now our server is restarting. Let's go into GraphiQL, so on your web server, if you don't have it open, make sure that you have localhost 4000/graphiql and let's just remove all that garbage. Perfect. Let's go ahead and do a query. One little trick with GraphiQL is that you can look into the history of the queries and mutations you've done, so if we click here, you'll see that we have a mutation that we've used last. Let's go ahead and click that, and it's going to bring what we've done the last time. So,…

Contents