This course is no longer maintained and may be out-of-date. While it remains available for reference, its content may not reflect the latest updates, best practices, or supported features.
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

