Hi,
I'm struggling the best way to understand how to do this. There is not much documentation for this lib.
In short i have a dynamic amount of mutations I need to preform in a single operations/call. I was trying to figure out some how i can dynamically build these or concat two qgl mutations together?
Any ideas?
multiple mutations can be constructed within the same call to graphql-tag like
import gql from 'graphql-tag';
const mutation = gql`
mutation {
mutationOne
mutationTwo
}
`
if you wanted to construct it dynamically, its just a matter of interpolating those strings (what gql is parsing is just a string, after all).
import gql from 'graphql-tag';
const mutationNames = ['mutationOne', 'mutationTwo'];
const mutation = gql`
mutation {
${mutationNames}
}
`;
@stevezau lmk if you still need help with this, i'm also in the Apollo slack if that is an easier way to answer this.
All good, forgot to reply. Thanks!
I cannot make it work, I am having the error : unexpected [
Most helpful comment
multiple mutations can be constructed within the same call to
graphql-taglikeif you wanted to construct it dynamically, its just a matter of interpolating those strings (what
gqlis parsing is just a string, after all).