New Shopify Certification now available: Liquid Storefronts for Theme Developers

GraphQL querying by useShopifyQuery() in new version CLI (started from 3.2)

Alex-Bosatski
Visitor
1 0 0

Hello,

Does anyone know a way to make hooks work in the new version of CLI/templates (started from v. 3.2)?

I moved the file useShopifyQuery.js to the new template, but all executions fail with an Error 500.

An example of code below:

 

 

 

import { useShopifyQuery } from "../hooks/useShopifyQuery.js";
import { gql } from "graphql-request";
export const GET_APP_ID = gql`
    query {
        AppInstallation {
            id        }
    }
`;
export default function HomePage() {

    const data = useShopifyQuery({
        key: 'ShopId',
        query: GET_APP_ID,
    })

    console.log(data)

    return (
        <div>Test</div>    );
}

 

 

 

 

 

 

Replies 0 (0)