Fork me on GitHub

Not sure if its exactly reagent specific, but how do I output html I am receiving from a db as a string.. so far all my attempts have dutifully escaped it, but in this case I don’t want it escaped (its not user input so not worried about sanitizing it)


In case anyone else runs into this problem: [:div {:dangerouslySetInnerHTML {:_html VAR-WITH-HTML_}}]

Jakub Šťastný13:03:19

Hey guys. I have this:

  [:a {:href "/"} "Home"]
  [:a {:href "/dashboard"} "Dashboard"]
How do I make it work programatically (having a fn returning list of these breadcrumbs)? The minute I introduce :<>, the individual breadcrumbs are no longer direct children of breadcrumbs, so they render without the formatting this component provides. Essentially I want something like:
[breadcrumbs (build-breadcrumbs current-route)]
But no matter what I try, it's just not producing the desired structure with :a being a direct children of breadcrumbs. (Essentially I want an analog to ~@ in macro expansion.) Is there a way to do it in hiccup?

Jakub Šťastný13:03:01

Probably completely irrelevant, but breadcrumbs comes from


(into [breadcrumbs] ...)

👍 2

Or a for loop as the only child, but only if you can provide a unique ^{:key ...} for each anchor vector.

Jakub Šťastný13:03:57

I found another way FYI:

[breadcrumbs {:children [
  (r/as-element [:a {} "Test"])
  (r/as-element [:a {} "abc"])
  (r/as-element [:a {} "xyz"])]}]