In my app, I have a lot of super-simple mutations that take in arguments, query the server, and return a JSON object (or sometimes, nothing at all). Always having to define types and write mutation boilerplate was a pain, so I created a simple withMutation
higher-order component.
Don't forget to call your mutation with variables
:
this.props.withMutation({variables: {foo: '123', bar: 'abc'}}).then(/*...*/).catch(/*...*/);
Note: make sure you use graphql-tools
v0.8.3 or above for the custom scalar type to work properly.