React Apollo - Make Multiple Queries

后端 未结 10 1954
渐次进展
渐次进展 2021-01-30 16:36

I have a queries file that looks like this:

import {gql} from \'react-apollo\';

const queries = {
  getApps: gql`
    {
      apps {
        id
        name
            


        
10条回答
  •  逝去的感伤
    2021-01-30 17:23

      const { loading: cat_loading, cat_error, data: cat_data } = useQuery(categoriesAllQuery)
      const { loading: prod_loading, prod_error, data: prod_data } = useQuery(productsAllQuery)
    
      if (cat_loading || prod_loading) return 

    Loading ...

    const { categoriesAll } = cat_data const { productsAll } = prod_data

提交回复
热议问题