Created
May 17, 2016 22:37
-
-
Save stubailo/0eb214361433d2e30bac36526920b886 to your computer and use it in GitHub Desktop.
Another example
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
| 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