Im trying out react starter kit and have some confusion with GraphQL and parameters. I just don't know how to pass parameters to the query:
fetch('/graphql', {
method: 'post',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: '{searchquery{title}}',
})
});
It's searchquery that should have a string argument somehow.
To answer my own question.
fetch('/graphql', {
method: 'post',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: '{searchquery(query:"test"){title}}',
})
});