todoの作成 - ミューテーション
ここでは、GraphQL Mutationを使って新しいtodoを作成する方法を学びます。
todoへの入力を実行するためのgraphql mutationを定義します。
mutation ($todo: String!, $isPublic: Boolean!) {insert_todos(objects: {title: $todo, is_public: $isPublic}) {affected_rowsreturning {idtitlecreated_atis_completed}}}
また、変数に値を渡す必要があります。
アプリケーションデータベースに対してGraphiQLを使ってこのミューテーションを 試して 、どのような応答が得られるか確認します。
この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](/learn/ja/graphql/react/static/hasura-free-ff60e409244e0ea12b5a3045d1a9096b.png)
![footer illustration](https://graphql-engine-cdn.hasura.io/learn-hasura/assets/footer-img.png)