Fork me on GitHub
#reagent
<
2017-12-08
>
pesterhazy09:12:06

I've heard good things about https://www.netlify.com/ (but haven't tried it myself) @aaelony

joshkh14:12:13

I'm trying to find some documentation but I'm having trouble defining exactly what I mean. Is it possible with Reagent to return a list of components such as (defn some-comp [] [[:span 1] [:span 2] [:span 3]]) *edited?

mikerod15:12:41

I believe it is the same idea

mikerod15:12:57

You can use some newer React features with Reagent, or you can avoid the pattern until later

joshkh15:12:48

Thanks, that's exactly what I was looking for. I have a component that returns one or more table rows. I was mapcatting the results but wasn't sure if that was the "right" thing to do.

mikerod15:12:58

@joshkh I think it comes up occasinally

mikerod15:12:30

The “newish” React “fragments” addresses the issue. And it looks like if you follow links given in that post I shared, you can see the Reagent approach to hooking into it. It’d depend on the versions you are using etc.

mikerod15:12:48

As far as what I’ve done so far, I’ve still just done it the “old school” way and avoiding the problem

mikerod15:12:05

If I need a helper fn to return a “list of components” I just call it as a fn from within another component

mikerod15:12:13

And do something like mapcat as you mentioned

mikerod15:12:17

The easy part to get confused I think is that the helper that returns a “list of components” doesn’t represent a valid “render fn” itself, so you’d call it with paren “(” instead of square bracket “[” and it wouldn’t have any fancy “don’t call when no arg changed” logic due to that.

joshkh15:12:16

Thanks for the help, @mikerod

mikerod15:12:52

No problem