mirror of https://github.com/status-im/reagent.git
Add notes abvout reactify-component alternatives
This commit is contained in:
parent
cc69bf479e
commit
6ea9d0400e
|
@ -8,8 +8,11 @@
|
|||
|
||||
(def DragHandle
|
||||
(js/SortableHOC.SortableHandle.
|
||||
(r/reactify-component
|
||||
(fn [] [:span "::"]))))
|
||||
;; Alternative to r/reactify-component, which doens't convert props and hiccup,
|
||||
;; 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
|
||||
(js/SortableHOC.SortableElement.
|
||||
|
@ -19,6 +22,17 @@
|
|||
[:> DragHandle]
|
||||
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
|
||||
(js/SortableHOC.SortableContainer.
|
||||
(r/reactify-component
|
||||
|
|
Loading…
Reference in New Issue