Fork me on GitHub

Hello 🙂 What React wrapper would you recommand between reagent, uix and helix?


reagent (& re-frame) are usually what I go with, and what I mostly see others use for react-based cljs front-ends


If you prefer thin wrappers then helix. If you prefer to have some nice things at the cost of more abstractions, then reagent. Can't say anything about uix - haven't used it. I almost always use reagent as well.


How does one explode a vector into args for multi-arity js functions? I stumbled across The discussed example works just fine in my cljs repl using apply. But, I can't seem to apply (pun intended) the same logic to some other js functions like Array.push i.e. (def a (js/Array.)) (apply (.-push a) [1 2]) doesn't work for me and throws #object[TypeError TypeError: Cannot assign to read only property 'length' of function 'function push() { [native code] }'] It's moments like this where I wish cljs just supported the js spread operator i.e. ... - I don't think it's that far of a cry from the dots and dashes one already has to use for interop.


hmm I'm not sure about that error yet (I can repro I just don't know why) but you can also use .apply and the prototype method:

(.apply js/Array.prototype.push a (to-array [1 2]))

💯 3

this is equivalent to the JS code:

Array.prototype.push.apply(a, [1, 2])


Ah, thanks! It works : - ) Forgot about the js apply function.


Hint: it works if you wrap (.-push a) in (.bind ... a). :)

👍 6

Array.prototype.push requires some this. (.-push a) is unbound.