I threw this together really quickly today. LMK if you find this useful. PRs accepted.
npm install @leveluptuts/comboquery
// Import your queries OR write them separately with gql``
import SINGLE_POST_QUERY from './graphql/SinglePost.graphql';
import USER_QUERY from './graphql/UserQuery.graphql';
const SomeComponent = () => {
const { slug } = useParams();
const COMBO_QUERY = comboQuery([SINGLE_POST_QUERY, USER_QUERY]);
// This example is using Apollo React Hooks
const { loading, data, error } = useQuery(COMBO_QUERY, {
variables: { slug },
});
// ... the rest of your stuffs
return ();
};