Fork me on GitHub

@peterbak There is the monet library.


is it common practice if writing a “composable” component that accepts arbitrary children to simply do this:

(defn wrapper [props & children]
  [:div “my wrapper”
    (first children)])
in order to “unwrap” the spread &? Is there a more idiomatic way?


Not sure if it is idiomatic, but i generally do something like this

(defn wrapper [props & children]
  (into [:div "my wrapper"] children))


if doing this, just good to note that the component will rerender a lot ... so good for leafy components, not sure about top-level ones


@gadfly361: i’m not sure that it would re-render any more than it would sans wrapper. If those props or children have cause to change, whatever is receiving them is going to re-render


@eyelidlessness I guess I am thinking of a specific scenario when you are iterating over a list (like rows in a table or something). Normally, you'd add a :key to the metadata to help React know that certain items don't need to be updated ... with into, it will rerender the entire list every time it tries to render (while also silencing the keys warning).