Skip to content

Instantly share code, notes, and snippets.

@tmeasday
Created March 31, 2017 07:04
Show Gist options
  • Select an option

  • Save tmeasday/936cb591176229c188fc422e3eac35d2 to your computer and use it in GitHub Desktop.

Select an option

Save tmeasday/936cb591176229c188fc422e3eac35d2 to your computer and use it in GitHub Desktop.
// 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