创建待办事项 - 变更
在本教程的这一部分中,您将学习如何使用 GraphQL 变更创建新的待办事项。
让我们定义一个 graphql 变更以执行插入到待办事项中。
mutation ($todo: String!, $isPublic: Boolean!) {insert_todos(objects: {title: $todo, is_public: $isPublic}) {affected_rowsreturning {idtitlecreated_atis_completed}}}
你还需要传入变量的值。
在 GraphiQL 中针对应用程序数据库尝试此变更,以查看响应是什么样的。
现在让我们将这个 graphql 变更集成到我们的 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/zh/graphql/react/static/hasura-free-ff60e409244e0ea12b5a3045d1a9096b.png)
![footer illustration](https://graphql-engine-cdn.hasura.io/learn-hasura/assets/footer-img.png)