Fork me on GitHub
#reagent
<
2017-08-15
>
theikkila10:08:32

you mean some kind of middleware?

talgiat16:08:27

Yes something like that

profgra16:08:14

Hi all, I followed [this](http://blob.tomerweller.com/reagent-import-react-components-from-npm) tutorial but cannot find any info about the 😆 macro. Is this a reagent one?

profgra16:08:17

Sorry, the :> macro.

juhoteperi16:08:49

@profgra It is not a macro, it just a normal keyword and Reagent implementation uses that to adapt React class to Reagent, same as adapt-react-class:

juhoteperi16:08:32

@profgra Nothing specific to Reagent or :> here, you just can't use #([]) to build a vector using anon function literal

juhoteperi16:08:57

The problem is that #( ) will call what ever you have inside it, so it will try to call the vector as function

juhoteperi17:08:08

you could use #(vector :> (bs 'MenuItem) ...) instead

profgra17:08:47

@juhoteperi OK I understand. Or I could use #(identity […]). Thank you very much.

noisesmith17:08:28

or (fn [] […]) which does the same thing but is more concise

mrchance21:08:30

Any idea what might be causing that? Or should I look for fault in the other component?

mikethompson22:08:15

@mrchance when you render you are reset!-ing layout. Which will cause a further render, which will reset! layout, etc. That would be my guess if you are seeing an infinite number of calls.

mikethompson22:08:18

So I'd look at your compute-layout function ... my guess is that each time it is being called it is calling the #(reset layout %) function given to it as a 2nd argument.

mrchance22:08:13

@mikethompson That sounds reasonable, but why doesn't it always happen? It's fine if I mount the component by itself

mrchance22:08:04

The looping only starts when I mount the other one

mrchance22:08:21

Hm, maybe some interplay with figwheel? You're right though, compute-layout does always call it, so it should be easy to fix