Multiple Mutation

Understand how to modify multiple data as a single GraphQL mutation request.

We now know how to modify server-side data and fetch multiple data requests on single queries. But what if we want to change the data on a single request?

Multiple mutations as a single request

On the field level, the mutation is just like a query. However, there’s an essential distinction between queries and mutations. While queries are parallel, mutations runs in a series, one after the other.

Suppose we send two CreatePizza mutations in one request. The first mutation will finish before the second begins, ensuring that we don’t end up with a race condition.

Using what we’ve learned so far, here is a mutation for CreatePizza in a single request.

Get hands-on with 1400+ tech skills courses.