Skip to main content

useShop

Provides access to the shopifyConfig prop of <ShopifyProvider/>.

Provides access to the shopifyConfig prop of <ShopifyProvider/>. Must be a descendent of <ShopifyProvider/>.

Examples
import {ShopifyProvider, useShop} from '@shopify/hydrogen-react';

export default function App() {
return (
<ShopifyProvider
storeDomain="my-store"
storefrontToken="abc123"
storefrontApiVersion="2022-10"
countryIsoCode="CA"
languageIsoCode="EN"
>
<UsingUseShop />
</ShopifyProvider>
);
}

export function UsingUseShop() {
const shop = useShop();

return (
<>
<div>{shop.storeDomain}</div>
<div>{shop.storefrontToken}</div>
<div>{shop.storefrontApiVersion}</div>
</>
);
}


Was this page helpful?