Handling Markdown in React

#This is a headline
<h1>This is a headline</h1>
import React from 'react';
import marked from 'marked';
class Post extends React.Component {
constructor(props, context) {
super(props, context);
this.rawMarkup = this.rawMarkup.bind(this);
rawMarkup() {
let rawMarkup = marked(this.props.data.data, {sanitize: true});
return { __html: rawMarkup };
render() {
var post = this.props.data;
return <div className="post">
<span dangerouslySetInnerHTML={this.rawMarkup()} />;



Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store