how to create resolver in schema for delete mutation in graphql/apollo?

i am trying to learn and apply graphql apollo in react projects. i created express server. I learned how to do queries and some mutations but i got stuck in creating the delete mutation. i have a mock json data. i fetch the data from there and created a mutation to delete the item. in the network tab i can see the right id in the variable section but when i refresh the user is still there. i am sharing all the thing related to deleting. i search all around but no luck. any help would be very much appreciated.

  deleteUser Resolver:

  deleteUser: {
   args: {
    id: { type: GraphQLInt },
   resolve(parent, args) {
    userData.filter((user) => !==;
    return args;

  delete mutation:
    export const DELETE_USER = gql`
    mutation deleteUser($id: Int) {
    deleteUser(id: $id) {

  delete function: 
  const handleDeleteUser = (id) => {
    variables: { id },

   const newUsers = users.filter((item) => !== id);

Read more here:

Content Attribution

This content was originally published by emira at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: