React Notion X
Fast and accurate React renderer for Notion.
Install
npm install react-notion-x
Usage
First you'll want to fetch the content for a Notion page:
import { NotionAPI } from 'notion-client'
const api = new NotionAPI()
const recordMap = await api.getPage('067dd719a912471ea9a3ac10710e7fdf')
Once you have the data for a Notion page, you can render it:
import React from 'react'
import { NotionRenderer } from 'react-notion-x'
export default ExampleNotionPage({ recordMap }) => (
<NotionRenderer
recordMap={recordMap}
fullPage={true}
darkMode={false}
/>
)
Styles
You'll need to import some CSS styles as well. If you're using Next.js, we recommend you put these in pages/_app.js
:
import 'react-notion-x/src/styles.css'
import 'prismjs/themes/prism-tomorrow.css'
import 'rc-dropdown/assets/index.css'
import 'katex/dist/katex.min.css'
License
MIT © Travis Fischer
Support my OSS work by following me on twitter