GraphQL mutations are the actions that cause side effects in your systems because they change the state of some resource that your UI cares about. What's interesting about mutations is that they care about side effects that happen to your data as a result of a change in the state of something. For example, if you change the information of a user, this will certainly impact the screen that displays the user information. But it could also impact a listing screen that shows the information of several users.
Let's see what a mutation looks like:
mutation changeTodoStatus($input: ChangeTodoStatusInput!) {
changeTodoStatus(input: $input) {
todo {
title
status
}
user {
todos {
title
status
}
}
}
}
`;
This mutation will change the status of a todo item and return the updated information of that todo. But that's not all this mutation does, as it also returns the user information...