Skip to content

Instantly share code, notes, and snippets.

@stubailo
Created May 17, 2016 22:37
Show Gist options
  • Select an option

  • Save stubailo/0eb214361433d2e30bac36526920b886 to your computer and use it in GitHub Desktop.

Select an option

Save stubailo/0eb214361433d2e30bac36526920b886 to your computer and use it in GitHub Desktop.
Another example
function mapMutationsToProps({ ownProps, state }) {
return {
postReply: (raw) => ({
mutation: gql`
mutation postReply(
$topic_id: ID!
$category_id: ID!
$raw: String!
) {
...
}
`,
variables: {
// Use the container component's props
topic_id: ownProps.topic_id,
// Use the redux state
category_id: state.selectedCategory,
// Use an argument passed from the triggering of the mutation
raw,
},
}),
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment