crystallize-content-chunk
Validation, parsing and React rendering for Crystallize Content Chunk. Makes it easy to build React Commerce solitions with Product Information Managmenet powered by Crystallize.
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);