React Apollo - Make Multiple Queries

后端 未结 10 1939
渐次进展
渐次进展 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:34

    According to this Link, to use compose() you need to follow these steps:

    1- install "recompose" package using npm i recompose

    2- import package using import { compose } from "recompose";

    3- use it in the form of:

    export default compose(
      graphql(Query1, { alias: "Query1" }),
      graphql(Query2, { alias: "Query2" })
    )(Test);
    

    documentation : https://www.apollographql.com/docs/react/api/react-apollo/

提交回复
热议问题