Fork me on GitHub
#reagent
<
2018-01-18
>
Casey14:01:17

Hmm is there a way to tell a component what class it should have when invoking it?

Casey14:01:43

[:div {:class "foobar"}]
works, but
[component {:class "foobar"}]
doesn't

Roman Liutikov14:01:23

@ramblurr in the second example you create an instance of a component and passing a hash of attributes, the component itself should read that attribute and pass it into an element

Casey14:01:44

ah, so I must explicitly handle it myself

Casey14:01:23

does that mean I should design every component such that it can expect the first argument to be a hash of attributes?

Roman Liutikov15:01:32

yes, at least in my experience it’s a good pattern

colindresj16:01:57

I’m having trouble getting a (previously working) reagent app running. In the browser I see:

colindresj16:01:59

Cannot read property 'render' of undefined
    at reagent$dom$render_comp (dom.cljs?rel=1516289963109:20)

colindresj16:01:43

Using reagent 0.8.0-alpha2

colindresj16:01:58

If I do window.ReactDOM in the browser, I see it

juhoteperi17:01:15

@colindresj Need for information. How are you providing React JS? Did you check the upgrade guide?

colindresj18:01:28

Have been using version 8 for a while now without problems, making this a bit weird

colindresj18:01:39

Bringing in react and all its siblings via cljsjs

juhoteperi18:01:19

Cljsjs should work. Check your deps to validate you have at least the same version as what Reagent depends on, or later.

colindresj18:01:36

Versions look good to me

colindresj18:01:12

I actually got this to build correctly but had to require cljsjs.react.dom myself, which I wasn’t doing before

juhoteperi19:01:38

@colindresj Strange. That shouldn't be needed.

colindresj20:01:19

Yeah that’s what I thought too, but that’s the only way I got it to work