Using multiple queries in a single useeffect hook in appolo graphql

195 Views Asked by At

I have to use multiple mutations in a single component and using 1 usequery hook; gql query definition is as follows.

Can anyone share the code for encorporating all these mutations in one usemutation hook.

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

There are 1 best solutions below

1
On BEST ANSWER
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)
   }`