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?

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

  1. Greetings I am so delighted I found your weblog, I really
    found you by error, while I was looking on Yahoo for something
    else, Nonetheless I am here now and would just like to say many thanks for a marvelous
    post and a all round thrilling blog (I also love the theme/design),
    I don’t have time to read through it all at the moment but I have
    saved it and also added in your RSS feeds, so when I have time I will be back to
    read a great deal more, Please do keep up the great job.

    Reply
  2. Good day! I know this is kinda off topic however , I’d figured
    I’d ask. Would you be interested in trading links or maybe guest authoring a blog article or vice-versa?
    My blog addresses a lot of the same subjects as yours and I feel we could greatly benefit from each other.
    If you are interested feel free to send me an e-mail. I look forward to hearing from you!
    Terrific blog by the way!

    Reply
  3. Great article! That is the type of information that are
    meant to be shared across the internet. Shame on Google for now not positioning this submit higher!
    Come on over and talk over with my website .
    Thanks =)

    Reply
  4. I loved as much as you’ll receive carried out right here.

    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get got an edginess over that you wish be delivering the following.
    unwell unquestionably come further formerly again since exactly the same nearly very often inside case you shield this hike.

    Reply
  5. First of all I would like to say awesome blog! I had a quick question that I’d like to ask if you
    do not mind. I was interested to find out how you
    center yourself and clear your head before writing. I have had trouble clearing my mind in getting my
    ideas out there. I do enjoy writing but it just seems like the
    first 10 to 15 minutes tend to be wasted just trying
    to figure out how to begin. Any ideas or hints?
    Many thanks!

    Reply
  6. Hello there, just became alert to your blog through Google,
    and found that it’s really informative. I am gonna watch out for brussels.

    I will be grateful if you continue this in future.
    Lots of people will be benefited from your writing.
    Cheers!

    Reply
  7. I would like to thank you for the efforts you have put in penning this blog.
    I really hope to check out the same high-grade blog posts by you in the future as well.
    In fact, your creative writing abilities has inspired me to get
    my very own website now 😉

    Reply
  8. I am extremely impressed with your writing skills as well as with the layout
    on your weblog. Is this a paid theme or did you modify it yourself?
    Anyway keep up the excellent quality writing, it is rare to see a nice blog like
    this one nowadays.

    Reply
  9. What i don’t understood is if truth be told how you
    are no longer actually much more well-preferred than you
    may be now. You’re so intelligent. You understand thus significantly when it
    comes to this topic, made me in my opinion imagine
    it from numerous varied angles. Its like men and women don’t seem to be interested until it is
    something to accomplish with Girl gaga! Your individual stuffs great.
    Always handle it up!

    Reply
  10. Admiring the time and energy you put into your blog and in depth information you provide.
    It’s great to come across a blog every once in a while that isn’t the same out of
    date rehashed material. Excellent read! I’ve
    saved your site and I’m including your RSS feeds to my Google account.

    Reply
  11. Hi there! I could have sworn I’ve been to this blog
    before but after checking through some of the post I realized it’s new to me.
    Anyways, I’m definitely glad I found it and I’ll be book-marking and checking back frequently!

    Reply
  12. Hiya very cool blog!! Man .. Beautiful .. Superb ..
    I will bookmark your web site and take the feeds additionally?

    I am happy to find a lot of useful info here in the put up, we need work out more strategies in this regard, thanks for sharing.
    . . . . .

    Reply

Leave a Comment