Created
March 31, 2017 07:04
-
-
Save tmeasday/936cb591176229c188fc422e3eac35d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // This is the avatar for a particular app, with a particular bump endpoint (GraphQL in this case) | |
| import React from 'react'; | |
| import { graphql } from 'react-apollo'; | |
| import gql from 'graphql-tag'; | |
| import Avatar from './Avatar'; | |
| export default graphql(gql` | |
| mutation bumpUser($userId: ID!) { | |
| bumpUser(id: $userId) { | |
| user { | |
| id | |
| bumps | |
| } | |
| } | |
| } | |
| `, { | |
| props({ mutate }) { | |
| const { userId } = this.props; | |
| return { | |
| onBump() { | |
| return mutate({ variables: { userId } }); | |
| }, | |
| }; | |
| }, | |
| )(Avatar); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment