Packages
react
providers
ReactProvider

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

NameTypeDescription
storeDomainstringThe full domain of your Airsoko storefront URL (e.g., subdomain.airsoko.com).
storefrontTokenstringThe Storefront API public access token.
storefrontApiVersionstringThe Storefront API version. This should match the version Hydrogen React was built for.
countryIsoCodeCountryCodeThe code designating a country, following ISO 3166-1 alpha-2 guidelines.
languageIsoCodestringISO 369 language codes supported by Airsoko.
childrenReactNodeReact children to render.

Notes

  • The AirsokoReactProvider component 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 the AirsokoReactProvider.
  • Ensure that all required props (storeDomain, storefrontToken, storefrontApiVersion, countryIsoCode, languageIsoCode) are provided to the AirsokoReactProvider.