splitbee / react-notion

A fast React renderer for Notion pages
https://react-notion.com
MIT License
2.86k stars 151 forks source link

Export createRenderChildText #51

Closed pyk closed 3 years ago

pyk commented 3 years ago

I tried to create custom block components for callout, but currently createRenderChildText is not exported.

With this small changes, I can do the following now:

import { NotionRenderer, createRenderChildText } from "react-notion";

// ...

const notionRenderChildText = createRenderChildText();

// Component
<NotionRenderer
    blockMap={notionBlocks ?? {}}
    customBlockComponents={{
        callout: ({ blockValue, renderComponent }) => (
            <div className="custom-class">
                {notionRenderChildText(blockValue.properties.title)}
            </div>
        ),
    }}
/>

Thank you!

tobiaslins commented 3 years ago

Looks good, thanks! :)