Closed mynsteria closed 2 years ago
Is this what you're looking for? Warning.. read up on dangerouslySetInnerHTML
in case you're not familiar with it. It can cause security vulnerabilities on un sanitised html.
<AccordionItemPanel
dangerouslySetInnerHTML={{ __html: yourHtml }}
/>
@mynsteria : You can do it as follows and sanitise the HTML string to avoid XSS.
<AccordionItemPanel>
<span dangerouslySetInnerHTML={{ __html: sanitizedHTMLString }}>
Exercitation in fugiat est ut ad ea cupidatat ut in
cupidatat occaecat ut occaecat consequat est minim minim
esse tempor laborum consequat esse adipisicing eu
reprehenderit enim.
</span>
</AccordionItemPanel>
@nithincvpoyyil that will work ok, but you don't really need to intorduce a span tag, see my answer above.
Where the inner html contains block elements like div, wrapping in span might lead to unexpected results, as by default span is an inline element.
@nithincvpoyyil that will work ok, but you don't really need to intorduce a span tag, see my answer above.
Where the inner html contains block elements like div, wrapping in span might lead to unexpected results, as by default span is an inline element.
Yes, you are correct, I just put a demo code. My point is to keep the panel & custom components separate for better decoupling.
I see, that you do not want to assume that dangerouslySetInnerHTML
will always work directly on AccordionItemPanel
. That's a fair point. I thnk it's safe to close this issue now right? @mynsteria
Tried \<Fragment> but that didn't work. Is there a way to render string passed in as HTML markup?