Course lesson
Use urql's useMutation Hook in React Native to Execute a Mutation
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.
- Duration
- 3 min
- Access
- Included
- Transcript
- Retained from source evidence
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:
- Bookmark emoji: https://emojipedia.org/bookmark/
urqlmutations docs: https://formidable.com/open-source/urql/docs/basics/react-preact/#mutations
Checkpoint: Add a story to bookmarks