simple-commonmark-react-router
v0.1.0
Published
Integrates React Router with Simple CommonMark React
Downloads
3
Readme
Simple CommonMark React Router
Easily integrate React Router with simple-commonmark-react
Example
import React from 'react'
import {
BrowserRouter as Router,
Route,
} from 'react-router-dom'
import { renderNodes } from 'simple-commonmark-react'
import ReactRouterLinkRenderer from 'simple-commonmark-react-router'
class MarkdownComponent extends React.Component {
render() {
const source = this.props.markdownText
const markdownOptions = {
className: 'markdown',
customRenderers: { link: ReactRouterLinkRenderer }
}
return (
<Router>
//Here you could put your routes
<div>
{ renderNodes(source, markdownOptions) }
</div>
</Router>
)
}
}