我是 react-native、graphql 和 Aws AppSync 的新手。我们尝试使用 aws appsync 构建一个react-native应用程序。当我运行react-native run-android时,它抛出一个错误说
传递给解析器的不是有效的 GraphQL DocumentNode。您可能需要使用“graphql-tag”或其他方法将操作转换为文档
请看一下
用于获取参考的图像 url。
import { graphql, compose } from 'react-apollo';
import gql from 'graphql-tag';
const listMessages = graphql(gql`
query listMessages {
listMessages {
id
text
createdAt
sentBy {
id
name
}
}
}`)
const createMessage = graphql(gql`
mutation createMessage($text: String!, $sentById: ID!) {
createMessage(input : {
id : $sentById
text : $text
createdAt : "1/06/2018"
updateAt:"1/06/2018"
}){
sentBy {
id
name
}
}
}`) …Run Code Online (Sandbox Code Playgroud)