Sign up for Hasura Newsletter
Loading...

todoの削除 - mutation

ここでは、GraphQL Mutationsを使って既存のtodoを削除する方法を学びます。

todosへのmutationを行うためのgraphql queryを定義します。

mutation removeTodo ($id: Int!) {
delete_todos(where: {id: {_eq: $id}}) {
affected_rows
}
}

アプリケーションデータベースに対してGraphiQLでこのmutationを 試して 、どのような応答が得られるかを確認します。また、変数に値を渡す必要があります。

このgraphql mutationをReactアプリに組み込みましょう。

Did you find this page helpful?
Start with GraphQL on Hasura for Free
  • ArrowBuild apps and APIs 10x faster
  • ArrowBuilt-in authorization and caching
  • Arrow8x more performant than hand-rolled APIs
Promo
footer illustration
Brand logo
© 2024 Hasura Inc. All rights reserved
Github
Titter
Discord
Facebook
Instagram
Youtube
Linkedin