Shopify Remix App: How to query Graphql multiple times?

Shopify Remix App: How to query Graphql multiple times?

wayforward
Shopify Partner
33 3 4
 

Hi,

 

I am aware of using Loader function and useLoaderData to fetch data using graphql.

 

const { admin } = await authenticate.admin(request);
const response = await admin.graphql(`<my graphql query`);
const data = await response.json();

But how do I make multiple graphql queries in my jsx.

Reply 1 (1)

SkylarRohter
Shopify Partner
4 0 0

You are able to make multiple graphQL queries within one loader. If you want to make another JSX you can have a separate request, however you should consider it's efficiency. 

 

GraphQL docs on this - https://www.propeldata.com/docs/guides/how-to-make-multiple-graphQL-queries-in-one-request