levand / quiescent

A lightweight ClojureScript abstraction over ReactJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

To apply or not to apply?

awkay opened this issue · comments

I've been using quiescent at work, and by accident we have, for quite some time, been combining lists and individual components within components:

(d/div {}
(d/span {} "Hi")
(map #(SomeThing ...) list)
...
)

and it works fine.

I see in many of the docs the recommendation that apply be used to unroll lists into the argument list. Not only is this a bit more code (and inconvenient in the above case where I want to mix and match)...it also seems to be unnecessary. The above code works just fine.

Has this changed since the docs were written, or are we screwing something up and just not seeing the badness of it?

Good question. I've been wondering about that, too. I haven't had to use apply at all. For instance, I can make tables with a few explicit rows, then to a mapv over a set of rows, then a few more singles. Works great!

I don't think I ever would have thought about the issue if not for the Parens of the Dead videos.

Well, I guess it is simply supported...maybe React itself is happy with the arrangement underneath in a new version and it is no longer needed...in which case the docs are out of date.