Created
July 20, 2020 18:50
-
-
Save acomito/9fb775ecce718f75659351eb2ea7ae94 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 React from 'react'; | |
import MY_MUTATION from 'ApolloClient/Mutations/myMutation.js' | |
import { graphql } from 'react-apollo' | |
class MyFunctionComponent extends React.PureComponent { | |
handleOnClick = async () => { | |
await this.props.myMutation({}) | |
} | |
render() { | |
return <button onClick={this.handleOnClick}>Click Me</Button> | |
} | |
} | |
export default graphql(MY_MUTATION, { name: 'myMutation' })(MyFunctionComponent) // will put the mutation into this.props |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment