This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-23
Channels
- # aws (4)
- # beginners (14)
- # boot (7)
- # cider (75)
- # clara (87)
- # cljsrn (6)
- # clojure (115)
- # clojure-berlin (2)
- # clojure-dusseldorf (2)
- # clojure-gamedev (8)
- # clojure-italy (15)
- # clojure-russia (9)
- # clojure-spec (46)
- # clojure-uk (195)
- # clojurescript (24)
- # css (44)
- # datascript (19)
- # datomic (18)
- # emacs (6)
- # fulcro (57)
- # hoplon (1)
- # jobs (3)
- # jobs-discuss (37)
- # jobs-rus (3)
- # luminus (6)
- # lumo (28)
- # off-topic (24)
- # onyx (11)
- # planck (8)
- # re-frame (31)
- # remote-jobs (12)
- # rum (10)
- # schema (4)
- # shadow-cljs (28)
- # specter (24)
- # sql (3)
- # tools-deps (34)
- # vim (43)
- # yada (10)
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 elementsis vec
the correct way to coerce a lazy sequence to a vector? (into [] (repeat n [:.label text]))
also works
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”
can’t I also pass a vector of tags? e.g. [:ul [[:li "one"] [:li "two"]]]
?
which is what I assumed (vec (repeat 2 [:li "thing"]))
was doing
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.