Fork me on GitHub
#reagent
<
2019-07-25
>
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

manutter5120:07:06

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.

oconn20:07:27

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!

alex22:07:46

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

lilactown22:07:23

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

lilactown22:07:36

e.g.:

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

alex01:07:49

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