How to run a mutation in react native using graphql-js-client?

156 Views Asked by At

I am using graphql-js-client for running mutations in react native (For Shopify mobile app). Is there any way to execute the mutations directly? The following is what I have made so far for customerCreate mutation.

import client from '../../config/graphql'
import {gql} from 'babel-plugin-graphql-js-client-transform'

const email = "[email protected]"
    const password = "HiZqFuDvDdQ7"

    return client.send(gql(client)`
    mutation customerCreate($input: CustomerCreateInput!) {
      customerCreate(input: $input) {
        customer {
          id
        }
        customerUserErrors {
          code
          field
          message
        }
    }
    `, {email, password}).then(res => {
        console.log(res)
    });
0

There are 0 best solutions below