You probably want to look deeper into dangerouslySetInnerHTML
. Here is an example how to render HTML from a string in a React component:
import React from 'react';
import { render } from 'react-dom';
const htmlString = '<h1>Hello World! 👋</h1>';
const App = () => (
<div dangerouslySetInnerHTML={{ __html: htmlString }} />
);
render(<App />, document.getElementById('root'));
Full example here: https://codesandbox.io/s/xv40xXQzE
Read more about dangerouslySetInnerHTML
in the React docs here: https://facebook.github.io/react/docs/dom-elements.html#dangerouslysetinnerhtml