Questions and discussions about using the Shopify CLI and Shopify-built libraries.
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.
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
that will unnecessarily slow down the loading.
It will be great if can query the graphql at will without exposing any api publicly