rum

Simple, decomplected, isomorphic HTML UI library for Clojure and ClojureScript | 0.12.8 https://github.com/tonsky/rum/blob/gh-pages/CHANGELOG.md#0128
2018-05-23T16:45:03.000178Z

anyone know why the following throws an error

(rum/defc repeat-label [n text]
  [:div (repeat n [:.label text])])
;; throws "Objects are not valid as a React child"
while explicitly converting to a vector works:
(rum/defc repeat-label [n text]
  [:div (vec (repeat n [:.label text]))])
In other instances I haven’t had issues rendering lazy sequences of elements

2018-05-23T16:57:26.000194Z

totally unexpected for me, from what I’d expect vec version shouldn’t work :)

2018-05-23T17:01:10.000385Z

is vec the correct way to coerce a lazy sequence to a vector? (into [] (repeat n [:.label text])) also works

2018-05-23T17:02:37.000139Z

yes. The thing is, vectors are supposed to be tags and have special meaning when parsed, and anything sequential that’s not vector is supposed to be “list of stuff”

2018-05-23T17:02:53.000628Z

maybe report to sablono? I suspect it’s their compiler

2018-05-23T17:04:33.000020Z

can’t I also pass a vector of tags? e.g. [:ul [[:li "one"] [:li "two"]]]?

2018-05-23T17:05:23.000528Z

which is what I assumed (vec (repeat 2 [:li "thing"])) was doing

2018-05-23T17:07:04.000386Z

though [:ul (map (fn [n] [:li n]) (range 5))] does work, so don’t know what the issue w/ repeat is. ran into this while working on the tutorial in the README.

2018-05-23T17:10:44.000059Z

no, it must be [:ul (list [:li "one"] [:li "two"])]

2018-05-23T17:10:58.000447Z

because vectors are reserved for tags

👍 1