Strong Snippets
A starter snippet to quickly create typed mutations.
Depending how you structure your queries/mutations/types, you might want to move the variable and data types to a separate file.
If you like the keep logic close together, consider creating a new file for each mutation.
Note: The type in your mutations might not be the same as in your typed variables file.
Library: graphql
Shortcut: start.typed.mutation
import { gql } from "@apollo/client";
export type PascalCaseQueryNameData = {
camelCaseQueryName: string;
};
export type PascalCaseQueryNameVariables = {
var1name: var1type;
};
export const UPPERCASE_UNDERSCORE_QUERYNAME = gql`
mutation camelCaseQueryName($var1name: yourGraphqlType) {
camelCaseQueryName(var1name: $var1name)
}
`;