How Do I Render an HTML String as HTML in a Component? #3993
-
Hey there! I'm looking for a simple equivalent to I have a string with HTM in it, I just want it to spit that HTML out as HTML. ( I know it's "dangerous", but not in my scenario when I'm getting the HTML from a sanitizing markdown parser for markdown that I, the developer, actually wrote in the first place. ) |
Beta Was this translation helpful? Give feedback.
Answered by
marvinhagemeister
May 7, 2023
Replies: 1 comment
-
You can inject HTML strings via the function RenderHTML() {
const markup = { __html: '<p>some raw html</p>' };
return <div dangerouslySetInnerHTML={markup} />;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
zicklag
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can inject HTML strings via the
dangerouslySetInnerHTML
prop: