I have a queries file that looks like this:
import {gql} from \'react-apollo\';
const queries = {
getApps: gql`
{
apps {
id
name
My preferred way is to use the compose
functionality of the apollo client (docu).
EDIT: If you have more than one query you should name them.
So in your case, it could look like this:
import React, {Component} from 'react'
import queries from './queries'
import { graphql, compose } from 'react-apollo';
class Test extends Component {
...
render() {
...
console.log(this.props.subjectsQuery, this.props.appsQuery); // should show both
...
}
}
export default compose(
graphql(queries.getSubjects, {
name: "subjectsQuery"
}),
graphql(queries.getApps, {
name: "appsQuery"
}),
)(Test);