Fork me on GitHub
#reagent
<
2017-01-17
>
rovanion07:01:39

@mccraigmccraig Will defenitely have a look at it during the day!

Pablo Fernandez08:01:58

I’m abstracting away react components with functions and the react components work, but the functions don’t get called. Any ideas why: http://stackoverflow.com/questions/41685450/reagent-function-not-being-called-why

pesterhazy08:01:09

@timothypratley thanks! I'd be curious how you deal with stateful comps

Pablo Fernandez08:01:14

@pesterhazy nothing there rings a bell for this issue, but maybe I’m missing something.

pesterhazy08:01:20

@pupeno I don't see anything wrong with your snippet

pesterhazy08:01:38

maybe something in the outside code? todo with your reloading setup in general?

pesterhazy08:01:34

or, perhaps, with your testing methodology? 🙂

pesterhazy08:01:44

maybe it's about the way ReactToolbox handles its children

pesterhazy08:01:02

remember the difference between React components and Reagent Components

pesterhazy08:01:12

well, if Tabs does something funky to its children, it may not work with a reagent component

Pablo Fernandez08:01:22

I'm not reloading nor testing. Im doing fresh loads.

pesterhazy08:01:41

e.g. if Tab needs to be a direct child of Tabs

pesterhazy08:01:58

(which in your case it probably isn't, because there's an intermediary Reagent wrapper)

pesterhazy08:01:18

you could try playing with reactify-component

Pablo Fernandez08:01:26

So, should the function tabs somehow manually render its contents?

pesterhazy08:01:32

personally I'd look into how Tabs is implemented

pesterhazy08:01:57

React components can iterate over the children, so maybe Tabs does that

Pablo Fernandez08:01:47

OK. I'll try that when I get back home. Thank you

pesterhazy08:01:55

you're welcome

pesterhazy08:01:32

would love to see more React libraries packaged for cljsjs btw, so I'm happy you're working on this

pesterhazy08:01:48

I've already had great success with react-virtualized and react-select (both wonderful libs)

pesterhazy08:01:37

if you do end up packaging it, it'd be great to add a reagent usage example in the README.md?

dottedmag13:01:04

I'd like to build a DOM structure similar to [:p [:div ...] [:div ...] [:div ...]], where divs are created out of a list. I came up with this monstruosity: "`[:p ~@(map #(vector :div ...) my-list)]". Is there a better way?

joshjones14:01:27

do you mean like this?

(def my-list “one” “two” “three”)
(into [:p]
      (for [i my-list]
        [:div i]))

dottedmag14:01:56

Ah, thanks. It's "auto-splicing".

pesterhazy14:01:12

with into there's no splicing