We'll use the useMutation
hook to expose the mutation function. Call the mutation function to add a story to bookmarks when the user taps the bookmark button.
Then we will ensure the bookmarkId
is returned in the mutation request value so its gets updates in the cache (and so also the UI).
During this process, we'll generate some types for the useMutation
to ensure we are passing in the correct data.
Resources:
urql
mutations docs: https://formidable.com/open-source/urql/docs/basics/react-preact/#mutationsCheckpoint: Add a story to bookmarks