AirsokoReactProvider Component
The AirsokoReactProvider component enables the use of the useShop() hook and provides specific values to various components and hooks within your React application.
Usage
import React from "react";
import { AirsokoReactProvider } from "@airsoko/react";
const App = () => {
const airsokoConfig = {
storeDomain: "your-store-domain",
storefrontToken: "your-storefront-token",
storefrontApiVersion: "2022-10",
countryIsoCode: "US",
languageIsoCode: "EN",
};
return <AirsokoReactProvider {...airsokoConfig}>{/* Your app content */}</AirsokoReactProvider>;
};
export default App;Props
| Name | Type | Description |
|---|---|---|
storeDomain | string | The full domain of your Airsoko storefront URL (e.g., subdomain.airsoko.com). |
storefrontToken | string | The Storefront API public access token. |
storefrontApiVersion | string | The Storefront API version. This should match the version Hydrogen React was built for. |
countryIsoCode | CountryCode | The code designating a country, following ISO 3166-1 alpha-2 guidelines. |
languageIsoCode | string | ISO 369 language codes supported by Airsoko. |
children | ReactNode | React children to render. |
Notes
- The
AirsokoReactProvidercomponent should wrap your entire application to provide Shopify-specific values to its components and hooks. - The
useShop()hook allows components to access Shopify-specific values provided by theAirsokoReactProvider. - Ensure that all required props (
storeDomain,storefrontToken,storefrontApiVersion,countryIsoCode,languageIsoCode) are provided to theAirsokoReactProvider.