Fork me on GitHub
Ashley Smith20:07:03

How do you do multiple classes in reagent?

Ashley Smith20:07:44

Trying to use bulma is tough when i can't use the nice :div.class syntax


You should be able to use :div.class.other-class just fine, but you can also use [:div {:class "this-class that-class other-class"} ...], if you need to build a list of classes on the fly.


Also collection support was added so - [:div {:class ["classname-1" "classname-2"]}] will work for building a dynamic list of classes.

Ashley Smith21:07:35

Thanks for all your help everyone!


If I make a React component available as an argument to another React component's renderFunction/function-as-a-child, then define the renderFunction/FaaC in Reagent land, what is the proper way to render the React component passed in as an argument/prop to the renderFunc


use reagent.core/as-element in the render function



(defn app []
  [:> lib/ReactComponent
    (fn function-child [thing]
      (reagent.core/as-element [:div (pr-str thing)]))])


Ah thank you, I'll give this a try when I get home. I think my mistake was to js->cljs the argument to the FaaC