loading queries from .graphql files and use them with apollo client and react

loading queries from .graphql files and use them with apollo client and react


0

Hi guys basicalle I’m creating an app using react, graphql and apollo client, currently I,m loading the queries from a .tsx file with this kind of structure

const MULTIPLE_WELLS_FROM_TAO2 = gql`
  query {
    query_multiple_wells_from_tao2db {
      selected_well {
        opru_fld_nme {
          value
        }
        prod_govt_lse_nbr {
          value
        }
        well_cmpl_seq_nbr {
          value
        }
      }
    }
  }
`;

and using it like

import MULTIPLE_WELLS_FROM_TAO2 from "my directory"

const { loading, data } = useQuery(MULTIPLE_WELLS_FROM_TAO2);

But my question is, is there a way to load this kind of queries but instead of using .tsx or .js files using .graphql files and use them like the one that I mentioned?

1


Load 7 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *