This is my clientMutations.js file. I am using gql from @apollo-client. import { gql } from "@apollo/client";
const DELETE_CLIENT = gql`
mutation deleteClient($id: ID!) {
deleteClient(id: $id) {
id
name
email
phone
}
}
`;
Here is the component that uses the query.
import { DELETE_CLIENT } from "../mutations/clientMutations";
export default function ClientRow({ client }) {
const { deleteClient } = useMutation(DELETE_CLIENT, {
variables: { id: client.id },
});
return (
<tr>
<td>{client.name}</td>
<td>{client.email}</td>
<td>{client.phone}</td>
<td>
<button className="btn btn-danger btn-sm" onClick={deleteClient}>
<FaTrash />
</button>
</td>
</tr>
);
}
i am getting Invariant Violation: Argument of undefined passed to parser was not a valid GraphQL DocumentNode. You may need to use 'graphql-tag' or another method to convert your operation into a document in my browser console.