1. 11
    Handle item deletions in Apollo using refetchQueries
    4m 16s

Handle item deletions in Apollo using refetchQueries

Share this video with your friends

Send Tweet

When making a mutation to delete an item in Apollo, there is no way to automatically mark that item as deleted based on the mutation return value. It cannot know how to update that were referencing that item now that it doesn't exist anymore. As a simple solution, we can use the refetchQueries option that the useMutation hook accepts, to tell Apollo which queries to refetch from the backend once the mutation has completed.