I have a queries file that looks like this:
import {gql} from 'react-apollo';
const queries = {
getApps: gql`
{
apps {
id
name
}
}
`,
getSubjects: gql`
{
subjects {
id
name
}
}
`
};
export default queries;
I then import this file to my React component:
import React, {Component} from 'react'
import queries from './queries'
class Test extends Component {
...
}
export default graphql(queries.getSubjects)(graphql(queries.getApps)(Test));
This will only get data for one of the queries (getApps) and not both. If I do one at a time so that it looks like this:
export default graphql(queries.getSubjects)(Test);
then it works but I don't have my other query. Yes, I have tested both separately and they work. How do I get it so that both queries show up in my props.data?
A query and mutation using react-apollo's compose
Things that I've concluded:
Here's the code if you still want to use compose: