Company
Date Published
Author
Khalil Stemmler
Word count
683
Language
English
Hacker News points
None

Summary

GraphQL mutations are used to modify server-side data, whereas queries are used to fetch data. Mutations represent the state-changing methods in REST, similar to `DELETE`, `PUT`, and `PATCH`. The structure of a mutation is similar to that of a query, with the main difference being the operation type (`mutation` instead of `query`). Server-side resolvers for mutations involve code that changes state, whereas those for queries typically only fetch data. When determining whether to use a query or a mutation, it's essential to ask yourself if you're fetching data or modifying server-side state.