This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-24
Channels
- # announcements (26)
- # babashka (9)
- # beginners (63)
- # calva (2)
- # chlorine-clover (22)
- # cider (2)
- # cljsrn (8)
- # clojure (36)
- # clojure-europe (36)
- # clojure-italy (5)
- # clojure-nl (76)
- # clojure-spec (9)
- # clojure-uk (8)
- # clojurescript (39)
- # conjure (24)
- # cursive (19)
- # data-science (1)
- # datascript (10)
- # datomic (1)
- # emacs (2)
- # events (5)
- # figwheel-main (9)
- # fulcro (21)
- # graalvm (1)
- # helix (5)
- # jobs (1)
- # jobs-discuss (1)
- # kaocha (1)
- # leiningen (4)
- # meander (2)
- # off-topic (22)
- # re-frame (16)
- # reitit (3)
- # rewrite-clj (75)
- # rum (1)
- # sci (51)
- # shadow-cljs (110)
- # tools-deps (16)
- # vrac (9)
- # xtdb (23)
Hi, in react javascript, you can map a list of data to render an array of components
{arrayOfData.map(x => <MyComponent key={x} x={x} />)}
How to do this in helix?
In this example, (.ticks x)
will return an array of date string
(d/g {:transform (str "translate(" (:left margin) "," (:top margin) ")")}
(for [val (.ticks x)]
(d/g {:key val}
(d/line
(d/text val)))))
But I'm getting error
React child (found: Sat May 01 2021 00:00:00 GMT+0400 (Gulf Standard Time)). If you meant to render a collection of children, use an array instead.
Oh sorry, the val
is actually a date. (d/text (.toString val))
gives this error though
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
✅ 3