-
Notifications
You must be signed in to change notification settings - Fork 10
render list
jiyinyiyong edited this page Mar 21, 2020
·
7 revisions
To render a list, you need use respo.core/list->
with children in key/value
pairs:
(list-> :div {:style {}}
[["a" (comp-text "this is A" nil)]
["b" (comp-text "this is B" nil)]])
If the tag is :div
, you can omit that and just write:
(list-> props children)
It's common pattern to use ->>
to transform the list:
(list-> :div
{:class-name "task-list",
:style style-list}
(->>
tasks
(reverse)
(map (fn [task] [(:id task) (task-component task)]))))
Child elements are rendered in the order that items appear in the list. Diffing is not very fast, so don't make the list too large.