How do you convert a string to jsx?

How do you convert a string to jsx?
0.0 0

#1

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) {
    super(props);
  }
  render() {
  	let htmlMarkup = markdown.toHTML(this.props.input);
    return (
      <div>
        <textarea value={this.props.input} onChange ={this.props.handleChange}></textarea>
        <h1>Preview:</h1>
        {htmlMarkup}
      </div>
    );
  }
};

export default TextEditor;

#2

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