How do you convert a string to jsx?

How do you convert a string to jsx?
0.0 0


I’m currently working on the Markdown Previewer project. The .toHTML method from the markdown module I’m using only returns the html as a string. I would like the variable htmlMarkup to render on the react page as html, rather than showing up as a string. Is there any way to turn the string into jsx?

import React from 'react';
import style from './textEditor.css'
const markdown = require( "markdown" ).markdown;

class TextEditor extends React.Component {
  constructor(props) {
  render() {
  	let htmlMarkup = markdown.toHTML(this.props.input);
    return (
        <textarea value={this.props.input} onChange ={this.props.handleChange}></textarea>

export default TextEditor;


You need to use dangerouslySetInnerHtml, or use a markdown plugin for React (most of which just wrap dangerouslySet…).