Add notes abvout reactify-component alternatives

This commit is contained in:
Juho Teperi 2018-10-19 13:01:52 +03:00
parent cc69bf479e
commit 6ea9d0400e
1 changed files with 16 additions and 2 deletions

View File

@ -8,8 +8,11 @@
(def DragHandle (def DragHandle
(js/SortableHOC.SortableHandle. (js/SortableHOC.SortableHandle.
(r/reactify-component ;; Alternative to r/reactify-component, which doens't convert props and hiccup,
(fn [] [:span "::"])))) ;; is to just provide fn as component and use as-element or create-element
;; to return React elements from the component.
(fn []
(r/as-element [:span "::"]))))
(def SortableItem (def SortableItem
(js/SortableHOC.SortableElement. (js/SortableHOC.SortableElement.
@ -19,6 +22,17 @@
[:> DragHandle] [:> DragHandle]
value])))) value]))))
;; Alternative without reactify-component
;; props is JS object here
#_
(def SortableItem
(js/SortableHOC.SortableElement.
(fn [props]
(r/as-element
[:li
[:> DragHandle]
(.-value props)]))))
(def SortableList (def SortableList
(js/SortableHOC.SortableContainer. (js/SortableHOC.SortableContainer.
(r/reactify-component (r/reactify-component