@propeller-commerce/propeller-v2-cms-react
v0.1.1
Published
CMS page renderer + block dispatcher + adapter provider for Propeller Commerce React shops. Pairs with any propeller-v2-cms-adapter-* package.
Downloads
101
Keywords
Readme
propeller-v2-cms-react
CMS page renderer + block dispatcher + adapter provider for Propeller Commerce React shops.
This package contains the rendering + provider layer. The actual CMS adapter (Strapi, Sanity, etc.) ships as a separate propeller-v2-cms-adapter-* package, which you install alongside this one.
What's in the box
<CmsAdapterProvider>— wires aCmsAdapterinstance into the React tree.useCms()— reads the adapter from context (for client islands that need optional CMS access).<CmsPageRenderer>— renders aCmsPage's block list.<CmsBlock>— single-block dispatcher; takes arenderersmap keyed byblock.type.
Minimal usage
import { CmsAdapterProvider, CmsPageRenderer } from 'propeller-v2-cms-react';
import { createStrapiAdapter } from 'propeller-v2-cms-adapter-strapi';
const adapter = createStrapiAdapter({ endpoint: process.env.CMS_URL! });
function App({ children }) {
return (
<CmsAdapterProvider adapter={adapter}>
{children}
</CmsAdapterProvider>
);
}
// In a page:
function Page({ page }) {
return (
<CmsPageRenderer
page={page}
renderers={{
hero: (block) => <HeroBlock data={block.data} />,
text: (block) => <TextBlock data={block.data} />,
}}
/>
);
}Block components are the shop's responsibility — this package ships no opinionated blocks because shop styling, layout, and content shape vary too much to share. Register whatever your CMS emits.
Pair with
- propeller-v2-core-ui — the framework-agnostic
CmsAdaptercontract this package builds on. - propeller-v2-cms-adapter-strapi — Strapi REST adapter.
- propeller-v2-react-ui — commerce components (cart, checkout, catalog).
