I am using ClojureScript Reagent. Which provides hiccup-like HTML generation.
I have a String with HTML:
(def code "<b>hello world</b>")
When passed to Hiccup it will be escaped and I get no bold text on my page:
[:div code]
How to pass code
to my HTML output so it will be integrated there without being escaped?
Use the dangerouslysetInnerHTML
native React call
[:div {:dangerouslySetInnerHTML {:__html code}}])
You need to use the raw-string
function from hiccup.utils
:
[:div (raw-string code)]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With