make mutation based on graphql docs code example
Example 1: graphql mutation passing data
input EventInput {
title:String!
desc:String!
price:Float!
}
type RootMutations{
createEvent(E_input:EventInput) : Event
}
Example 2: apollo client mutation without component
import React, { Component } from "react";
import { DO_MUTATION } from "./mutations";
import { withApollo } from "react-apollo";
import SomeLibrary from "SomeLibrary";
export class MyComponent extends Component {
render() {
return (
<Button
onPress={() => {
SomeLibrary.addListener(this.listenerHandler);
}}
/>
);
}
listenerHandler = () => {
this.props.client.mutate({
mutation: DO_MUTATION,
variables: {
some_var: "some_val",
},
});
};
}
export default withApollo(MyComponent);