@pack/react
v4.2.0
Published
React
Keywords
Readme
@pack/react
React UI primitives for rendering Pack content and storefront configuration.
Install
npm install @pack/reactMain exports
PackProvider/PreviewProviderRenderSections,useSectionsregisterSectionregisterStorefrontSettingsSchemausePackContext,useSiteSettings,useLocalePackErrorBoundary
Usage
import { PackProvider, RenderSections } from '@pack/react';
export function App({
sections,
siteSettings,
packSessionId,
isPreviewModeEnabled,
packErrorTracking,
}: Props) {
return (
<PackProvider
siteSettings={siteSettings}
packSessionId={packSessionId}
isPreviewModeEnabled={isPreviewModeEnabled}
packErrorTracking={packErrorTracking}
>
<RenderSections sections={sections} />
</PackProvider>
);
}packSessionId and packErrorTracking can be passed from ...pack.getPackContextData() when using @pack/hydrogen.
Development
yarn
yarn build
yarn test