Created
July 14, 2022 00:28
-
-
Save wickstjo/aa94efd211da90e0a73bc3017dbe205c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { gql, useMutation } from '@apollo/client' | |
const QUERY = gql` | |
mutation AddBook($title: String!, $published: Int!, $author: String!, $genres: [String!]!) { | |
addBook(title: $title, published: $published, author: $author, genres: $genres) { | |
title | |
published | |
author | |
genres | |
} | |
} | |
` | |
const [addBook] = useMutation(QUERY) | |
addBook({ | |
variables: { | |
title: title.value, | |
published: published.value, | |
author: author.value, | |
genres: genres.value.split(','), | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment