Fork me on GitHub

I have a simple react-component that takes some variable number of args, like this:

[(r/adapt-react-class Stuff)
 {:args :whatever}
Now, I want to supply those items as a list, how can I use apply (for instance) to make this work?


Just to be clear, I want to achieve something along the following

(let [items [[item1][item2][item3]]] 
 [(r/adapt-react-class Stuff)
  {:args :whatever}


Use into. Also, you can replace (r/adapt-react-class Stuff) with :> Stuff. Alternatively, move (r/adapt-react-class Stuff) to an outer def to avoid calling that function on each render (the function is cheap, but it's still an extra call).

😀 1

And if items is a real list and not a vector, you can just supply it as is. React might complain about a missing :key (not sure if that's only for lazy collections or for regular lists as well). In that case, either provide :key if it's possible to use an organic key and not a synthetic one, or just use into.


Thank you so much!

👍 1