在Appolo graphQl中的单个useeffect挂钩中使用多个查询

问题描述

我必须在单个组件中使用多个突变,并使用1个usequery钩子; gql查询定义如下。

任何人都可以共享将所有这些突变整合到一个usemutation挂钩中的代码

const Edit_Profile=gql`mutation{
  changeName(
    name: "navaneeth"
  )
  updateAvatar(
    avatar_id: "11"
  )
   updateCity (
    city:"bglr"
  )
  updateAbout (
    about:"am lino"
  )
}

解决方法

const Edit_Profile = gql`mutation EditProfile(
    $name: String!
    $avatar_id: String
    $city: String
    $about: String
   ) {
    changeName(name: $name)
    updateAvatar(avatar_id: $avatar_id)
    updateCity(city: $city)
    updateAbout(about: $about)
   }`