George Mauer
George Mauer

Reputation: 122052

Whats the non-jsx equivalent of dangerouslySetInnerHTML?

I'm working through the reactjs tutorial but am trying to avoid jsx and use the virtual DOM manually. How do I do the equivalent of

<span dangerouslySetInnerHTML={{__html: rawMarkup}} />

Upvotes: 11

Views: 1266

Answers (1)

George Mauer
George Mauer

Reputation: 122052

Found the answer plugging around the source code:

React.DOM.div({ dangerouslySetInnerHTML: {
    __html: markdown.makeHtml(this.props.children.toString())
} });

or in coffeescript:

 R.div dangerouslySetInnerHTML: __html: markdown.makeHtml @props.children.toString()

Upvotes: 17

Related Questions