aws-mobile-appsync-sdk-js icon indicating copy to clipboard operation
aws-mobile-appsync-sdk-js copied to clipboard

Instead of graphqlMutation, what package need to used from apollo/client.

Open savita-malaghan opened this issue 4 years ago • 1 comments

Instead of graphqlMutation, what package need to used from apollo/client. I dont want to add "aws-appsync-react".

savita-malaghan avatar Jan 05 '21 11:01 savita-malaghan

Make sure you have "aws-amplify" installed and configured.

Do import { gql, useMutation } from "@apollo/client" and then establish const [makeToDo] = useMutation(gql(createToDo))

makeToDo() is the function that executes the mutation so you can execute the following example as the first argument is the input for the mutation makeToDo({ variables: { input: { task: "ToDo" } } })

https://www.apollographql.com/docs/react/data/mutations/

randomslap avatar Jan 08 '21 23:01 randomslap