There is code with GraphQL in bff and in the application part. This function is described as follows:
shema.js:
type Mutation {
deleteCart(id: Int): [Cart]
}
index.js:
deleteCart: (_, args) => {
carts = carts.filter((c) => c.id !== args.id);
return carts;
}
As declared in query:
export const CART_ITEMS = gql`
mutation DeleteCart ($id: Int) {
deleteCart(id: $id) {
id, title, text, size, price, image
}
}`
It’s also not entirely clear how to implement triggering via button clicks onClick
.
When I try to do this inside the GraphQL graphical interface, I get an error:
Assignment to constant variable
New contributor