helix

https://github.com/Lokeh/helix
jaime 2020-08-24T19:48:18.003700Z

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.

lilactown 2020-08-24T20:02:44.004100Z

Is it a date or a string?

lilactown 2020-08-24T20:03:11.004900Z

The code looks fine but it looks like react doesn’t like whatever ‘val’ is

jaime 2020-08-24T20:10:26.005900Z

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.

1✅
jaime 2020-08-24T20:12:29.006800Z

Looks like code formatting changes the parenthesis positions. (d/text (.toString val))`` works actually. 😅

1