Hiccup with parameters gives compiler error
Jarzka opened this issue · 1 comments
Jarzka commented
I'm trying to use select2 library with hiccups. select2 wants templateResults parameter, which is a function, which returns HTML string wrapped inside jQuery. Like this:
(.select2 dom-node (clj->js {:templateResult (fn [state]
(js/$ (html
[:div
[:label "Value"]
[:div "Something"]])))}))
It seems that if I want to use parameters from state
, the html
macro does not work anymore. I get a compile warning saying that hiccups is not even defined if I do this
(.select2 dom-node (clj->js {:templateResult (fn [state]
(js/$ (html
[:div
[:label (:text state)]
[:div "Something"]])))}))
I wonder if this because html
is a macro instead of function. Would it be possible to implement html
as a function to make this work?
Jarzka commented
It seems that I can do this with reagent.dom.server/render-to-string
.