React-Apollo error: "…only supports a query, subscription, or a mutation per HOC"

I am trying to create two separate mutations in this format:

import gql from 'graphql-tag';

const MUTATION = gql`
  mutation setItem($item:String!) {
    setItem(item:$item)
  },
  mutation setAnotherItem($setAnotherItem:Bool) {
    setAnotherItem(setAnotherItem:$setAnotherItem)
  }
`;

But I am getting this error:

Invariant Violation: react-apollo only supports a query, subscription, or a mutation per HOC. [object Object] had 0 queries, 0 subscriptions and 2 mutations. You can use 'compose' to join multiple operation types to a component

What is the proper way to structure this so that both mutations are usable?

23 thoughts on “React-Apollo error: "…only supports a query, subscription, or a mutation per HOC"”

Leave a Comment