Gatsby 盖茨比图形是否需要周围的括号?

Gatsby 盖茨比图形是否需要周围的括号?,gatsby,graphql-js,Gatsby,Graphql Js,我对盖茨比不熟悉,尤其是有趣的语法选择(只对字符串使用模板文本,不包括结尾分号) 我的问题是:是否需要用括号括住graphql查询?文档没有真正解释使用graphql的语法,教程中有带括号和不带括号的查询 exports.createPages=async({graphql,actions})=>{ ... const result=wait graphql(`在gatsby node.js文件中,您需要使用一个常规的旧函数,即graphql() 在React land/components中

我对盖茨比不熟悉,尤其是有趣的语法选择(只对字符串使用模板文本,不包括结尾分号)

我的问题是:是否需要用括号括住graphql查询?文档没有真正解释使用graphql的语法,教程中有带括号和不带括号的查询

exports.createPages=async({graphql,actions})=>{
...

const result=wait graphql(`在
gatsby node.js
文件中,您需要使用一个常规的旧函数,即
graphql()

在React land/components中,您可以使用,如第二个示例所示。这是因为Gatsby和其他东西一起使用Babel来提取查询并运行它

exports.createPages = async ({ graphql, actions }) => {
  ...
  const result = await graphql(`     <--- parentheses here
    query {
      allMarkdownRemark {
        edges {
          node {
            fields {
              slug
            }
          }
        }
      }
    }
  `)
  console.log(JSON.stringify(result, null, 4))
}
export const query = graphql`     <--- no parentheses here
  query {
    site {
      siteMetadata {
        title
      }
    }
  }
`