block-content-to-react
block-content-to-react copied to clipboard
Pass in additional props to serialisers from render level
It's more of a question, but wanted to see if it's possible and if we could turn it into a feature.
Currently each mark serialiser is getting only props from a mark, but I need to use additional props that will be passed to <PortableText />
.
Example:
export const PortableText = createPortableTextComponent({
...sanityConfig,
serializers: {
marks: {
someSerializer(props, propsFromPortableText) {
return <span>{props.children} {propsFromPortableText.something}</span>
}
},
},
});
<PortableText blocks={blocks} extraProps={{ something: 50 }} />
Any ideas?