crystallize-content-chunk
Validation, parsing and React rendering for Crystallize Content Chunk. Makes it easy to build React Commerce solutions with Product Information Management powered by Crystallize that enable Fast Ecommerce API.
Install
yarn add @crystallize/content-chunk
Validate
import CCC from '@crystallize/content-chunk'
const isValid = CCC.isModelValid(myModel)
const validationDetails = CCC.isModelValidVerbose(myModel)
React chunk
import Chunk from '@crystallize/content-chunk/reactChunk';
const overrides = {
link: p => <MyLinkComponent href={p.metadata.href}>{p.textContent}</MyLinkComponent>
};
<Chunk {...cccModel} overrides={overrides} />
toHTML
import toHTML from '@crystallize/content-chunk/toHTML';
toHtml(cccModel);
toText
import toText from '@crystallize/content-chunk/toText';
toText(cccModel);