Open yuu2lee4 opened 6 years ago
If the fragment is within the query, it should work
Using the template string variable expansion doesn't work with nanographql
export const GET_LESSONS = gql`
query {
lessons {
...LessonFields
}
}
${LessonFields}`
The above leads to a query with nothing where the fragment should be.
It is being treated as a tagged template literal, but it is not coded to handle parameters like that.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
Instead you can do below, evaluate it before it goes to the function
gql(`query .... ${fragment}`)
support fragment?