What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Shopify Remix App: How to query Graphql multiple times?

Shopify Remix App: How to query Graphql multiple times?

wayforward
Shopify Partner
43 4 6
 

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.

Replies 2 (2)

SkylarRohter
Shopify Partner
5 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 

wayforward
Shopify Partner
43 4 6

that will unnecessarily slow down the loading.

It will be great if can query the graphql at will without exposing any api publicly