how would I go about doing nested mutations? ``` ...
# prisma-whats-new
b
how would I go about doing nested mutations?
Copy code
const createUser = gql`
  mutation ($idToken: String!, $name: String!, $emailAddress: String!){
    createUser(authProvider: {auth0: {idToken: $idToken}}, name: $name, emailAddress: $emailAddress) {
      id
      name
      createCloset(userId: id)
    }
  }
`
is this the right way? How can i pass in the createdUser's id into createCloset?
everytime I create a new user, I want to also create a new Closet for that user
n
@be4r
b
@nilan thanks for the docs, so I also used react-apollo's { compose } method to enable multiple mutations on a component. I then created a Component method that will call one mutation then chain to the next one. Is this approach alright? Or would you recommend the approach from the docs?
n
the mentioned approach is not correct. A nested create mutation is one mutation with additional arguments that created two nodes at the same time and connects them.