Cant import gql

Viewed 181

Im having a problem with importing gql from graphql-tag . everytime i import it gives me this error

Error: Uncaught Invariant Violation: Argument of [object Object] passed to parser was not a valid GraphQL DocumentNode. You may need to use 'graphql-tag' or another method to convert your operation into a document

this is how my import and query looks

import  gql from 'graphql-tag'
const TOP_POST = gql` 
{                                                               
topPost{
       id
       content
    }
 }`

`

I dont know if this is a react-native problem or a problem on my end , but does anybody know how i could fix this?

1 Answers

There's a typo in your query. It should be:

import  gql from 'graphql-tag'
const TOP_POST = gql`                                                                
    query topPost {
       id
       content
    }`
Related