← GraphQL learning pathGraphQL · Module 4 of 10
Mutations
Create, update and delete data with mutations.
📖 Key ideas
- mutation { createPost(input: { title: "Hi" }) { id title } }.
- Mutations return data so the client can update its UI.
- Use input types for arguments.
- Name mutations as verbs: createUser, updatePost, deleteComment.
- Return errors in a predictable way.
💡 Real-life example: A mutation is filling a form at the counter and getting a receipt with the new details.
MutationWrite operation
Input typeTyped argument object
PayloadData returned after a mutation
Optimistic updateUpdate UI before server confirms