react-apollo icon indicating copy to clipboard operation
react-apollo copied to clipboard

Error with gql tag

Open eedfa opened this issue 8 years ago • 3 comments

When I try to run my request with console.log(loadBoards.kind) console.log('loadBoards.kind') export default compose(connect(_mapStateToProps), graphql(loadBoards, { name: 'loadBoards' }))(BoardList) I get the following error Network error: Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? Here is my definition of the query const loadBoards = gql query($boardName:String,$boardId:String){ boards(boardName:$boardName,boardId:$boardId){ boardName id ratingAmount ratingScore } } ``

eedfa avatar Nov 12 '18 15:11 eedfa

@eedfa is this still an issue for you?

Trying to clean up your question:

const loadBoards = gql
  query($boardName:String,$boardId:String) {
    boards(boardName:$boardName,boardId:$boardId) {
      boardName id ratingAmount ratingScore
    }
  }

Should be:

const loadBoards = gql`
  query($boardName:String,$boardId:String) {
    boards(boardName:$boardName,boardId:$boardId) {
      boardName id ratingAmount ratingScore
    }
  }
`;

Notice the ` that denotes template strings

OllieJennings avatar Nov 14 '18 09:11 OllieJennings

I have them.Still have the problem.

eedfa avatar Nov 16 '18 18:11 eedfa

Please submit questions to the slack channel or stack overflow. We need to keep this tracker focused on actionable issues.

rosskevin avatar Dec 27 '18 02:12 rosskevin