Inspired by: apollographql/graphql-tag#169 (comment)
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 ();
};
https://www.leveluptutorials.com
Cutting-edge, focused & high quality video tutorials for web developers and designers
A Tasty Treats Podcast for Web Developers.