当我使用 gql(来自“graphql-tag”)进行查询/突变/订阅时,出现错误。
\n有谁遇到过这个错误并且知道如何修复它?
\n这是我的代码:
import React from \'react\';\nimport { Mutation } from \'react-apollo\';\nimport MUTATION from \'./query.js\';\nimport gql from \'graphql-tag\';\n\nconst ADD_POST_MUTATION = gql`\n mutation addPost($content: String!, $author: String!)\xc2\xa0{\n addPost(content: $content, author: $author) {\n content\n author\n }\n }\n`;\n\nexport default class Tool extends React.Component {\n state = {\n content: \'\',\n author: localStorage.getItem(\'user\') || \'\'\n };\n\n handleSubmit = (e, mutation) => {\n console.log(mutation);\n e.preventDefault();\n mutation({ variables: { content: this.state.content, author: this.state.author }})\n .then(res => console.log(res))\n .catch(e => console.log(e));\n }\n\n render() {\n return …Run Code Online (Sandbox Code Playgroud)