React 初学者工具包和 GraphQL 参数

React starter kit and GraphQL arguments

我正在试用 React 入门工具包,但对 GraphQL 和参数有些困惑。我只是不知道如何将参数传递给查询:

fetch('/graphql', {
            method: 'post',
            headers: {
                Accept: 'application/json',
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({
                query: '{searchquery{title}}',
            })
        });

搜索查询应该有一个字符串参数。

回答我自己的问题。

fetch('/graphql', {
        method: 'post',
        headers: {
            Accept: 'application/json',
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            query: '{searchquery(query:"test"){title}}',
        })
    });