Answers for "graphql apollo client mutation syntax"

0

graphql apollo client mutation syntax

import { gql, useMutation } from '@apollo/client';

// Define mutation
const INCREMENT_COUNTER = gql`
  # Increments a back-end counter and gets its resulting value
  mutation IncrementCounter {
    currentValue
  }
`;

function MyComponent() {
  // Pass mutation to useMutation
  const [mutateFunction, { data, loading, error }] = useMutation(INCREMENT_COUNTER);
}
Posted by: Guest on August-10-2021

Code answers related to "graphql apollo client mutation syntax"

Browse Popular Code Answers by Language