todoの一括削除 - mutation
ここでは、完了した既存のtodoをGraphQL Mutationsを使って一括削除する方法を学��ます。
todosへのmutationを行うためのgraphql queryを定義します。
mutation clearCompleted {delete_todos(where: {is_completed: {_eq: true}, is_public: {_eq: false}}) {affected_rows}}
また、variablesに値を渡す必要があります。
アプリケーションデータベースに対してGraphiQLを使ってこのmutationを 試して 、どのような応答が得られるかを確認します。
このgraphql mutationをReactアプリに組み込みましょう。
Did you find this page helpful?
Start with GraphQL on Hasura for Free
Build apps and APIs 10x faster
Built-in authorization and caching
8x more performant than hand-rolled APIs
![Promo](https://cdn.statically.io/img/hasura.io/learn/ja/graphql/react/static/hasura-free-ff60e409244e0ea12b5a3045d1a9096b.png)
![footer illustration](https://cdn.statically.io/img/graphql-engine-cdn.hasura.io/learn-hasura/assets/footer-img.png)