I've got an MDX page I'm trying to build that will function as a Markdown editor and preview. I'm just having a hard time getting the preview to render. All the online and AI searches return React focused answers mention an html attribute called dangerouslySetInnerHtml which I'm sure is react specific.
Given this code snippet how would I get the result to actually render as true HTML, instead of what it currently does which displays all of the HTML as a simple string inside the div?
import MarkdownIt from 'markdown-it'
import markdownitanchor from 'markdown-it-anchor'
export const Rendered = () => {
const md = MarkdownIt({
html: true,
linkify: true,
typographer: true
})
md.use(markdownitanchor)
let result = md.render('# markdown-it rulezz!')
return <div>{result}</ div>
}
<textarea />
<Rendered />