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
|
(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
|
||||||
|
|
Loading…
Reference in New Issue