Skip to content

Instantly share code, notes, and snippets.

@acomito
Created July 20, 2020 18:48
Show Gist options
  • Save acomito/61ec2f948ad7151ebef0495c1d39144b to your computer and use it in GitHub Desktop.
Save acomito/61ec2f948ad7151ebef0495c1d39144b to your computer and use it in GitHub Desktop.
import React from 'react';
import MY_MUTATION from 'ApolloClient/Mutations/myMutation.js'
import { useMutation } from 'react-apollo'
const MyFunctionComponent = () => {
const [myMutation] = useMutation(MY_MUTATION);
const handleOnClick = async () => {
await myMutation({})
}
return <button onClick={handleOnClick}>Click Me</Button>
}
export default MyFunctionComponent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment