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?
You can wrap for in βdoallβ
Thanks!
lazy seqs are fine to use in helix components
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?Dynamic Props https://github.com/lilactown/helix/blob/master/docs/creating-elements.md#dynamic-props
Thanks Derek!! Didn't notice this.
You're welcome π