Replies: 1 comment
-
Do you mean that you don't know what to do with the result of One use is const exampleHTMLString = '<h1>Hello World!</h1>';
// Produces `<div><h1>Hello World!</h1></div>`
const MyComponent = () => <div dangerouslySetInnerHTML={{ __html: exampleHTMLString }} /> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello every one,
I'm new here and I found out preact, and this page : https://github.com/preactjs/preact-render-to-string to render a component as string.
If we start from the example on this page, with the box and the fox, my question is.
Let's suppose we have a JSX file that contains the component :
Then how would it be possible to render a component of this file, for example, same as the example :
I tried to do something with html-react-parser to parse JSX code but then I don't know what to do with the parsed JSX...
I feel i'm wrong doing this...
But can someone help me about it ?
My goal with that : allow a user to type JSX on a webpage, and render a component dynamically (static component, no interaction).
Thank you for your help (and I hope i'm at the good place to ask this question :) )
Beta Was this translation helpful? Give feedback.
All reactions