Open davidalekna opened 5 years ago
You're in luck! It looks like the graphql()
function does accept a mutation instead of a query: https://www.apollographql.com/docs/react/api/react-apollo/#graphql-options-for-mutations
As far as queries and mutations together, I think you'll ways need to fire them as separate requests. GraphQL doesn't accept a Query and Mutation at the same time, but note that Mutations will return the new value once they're done mutating. Not sure if that's exactly what you meant but something to note.
Hi! So the problem I'm trying to solve is not actually a problem, more like a cleanup solution to components that have mutations and queries and other compositions all together. React-apollo package has a { graphql } export that composes really well with react components, but I couldn't find a solution to simply compose mutations on a simple function that could be called from react component. Something like this:
I was wondering is there a way to compose those with something like ramda, or a custom composition function? Maybe something worth adding to the package...