Let's get you some practice with reading from and writing to the cache by having you go through this same process with deleting a habit.
writeQuery with the delete habit mutation in
I do have one clue for you that you probably wouldn't guess: you can use the options object with a mutation in two different ways. The first way is what we've been doing; passing it to the
useMutation hook as its second argument. This makes any calls to that mutation use those same options.
The second way is with the provided mutation function that we pull out of the hook. In this case, that's the
deleteHabit function. If we pass the options object here, we can change the options on a case-by-case basis.
With that, give it a shot! I'll show you the solution in the next video.