Fork me on GitHub
#helix
<
2023-09-13
>
stagmoose14:09:39

if i defnc a component, how can i loop over a vector of items to use that component and put them inside a div? for is lazy. so maybe mapv ? or do i have to write ~@ macro like the todomvc example?

alexdavis14:09:05

You can wrap for in ‘doall’

🙏 2
lilactown17:09:46

lazy seqs are fine to use in helix components

🙏 1
stagmoose15:09:27

I am confused by this example

(#($ Sentence %) (first mock-data))
;; => #js {"$$typeof" "Symbol(react.element)", :type #object[dudee$core$Sentence_render], :key nil, :ref nil, :props #js {:children {:content "this is 1"}}, :_owner nil, :_store #js {}}
($ Sentence (first mock-data))
;; => #js {"$$typeof" "Symbol(react.element)", :type #object[dudee$core$Sentence_render], :key nil, :ref nil, :props #js {:children {:content "this is 1"}}, :_owner nil, :_store #js {}}
(first mock-data)
;; => {:content "this is 1"}


($ Sentence {:content "this is 1"})
;; => #js {"$$typeof" "Symbol(react.element)", :type #object[dudee$core$Sentence_render], :key nil, :ref nil, :props #js {:content "this is 1"}, :_owner nil, :_store #js {}}
The result of (first mock-data) should imply ($ Sentence (first mock-data)) and ($ Sentence {:content "this is 1"}) are the same, but the result is different! Did I miss anything?

stagmoose15:09:16

Thanks Derek!! Didn't notice this.

Derek22:09:11

You're welcome 🙂

🙏 1