Questions and discussions about using the Shopify CLI and Shopify-built libraries.
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> );
}