WIP...
React toolkits in ClojureScript based on React component in pure cljs using ES6 class inheritance
Demo http://repo.respo-mvc.org/reacher/
[respo/reacher "0.2.0"]
Example:
(defn comp-space [props]
(let [w (j/get props :w), h (j/get props :h)]
(if (some? w)
(div {:style {:display :inline-block, :width w}})
(div {:style {:height h}}))))
(defn comp-creator []
(let [[draft set-draft!] (React/useState "")
[states update-states!] (use-states {:draft ""})
dispatch! (use-dispatch)]
(React/useEffect (fn [] (.. js/document (querySelector ".box") (focus))) (array))
(div
{:style ui/row-middle}
(input
{:class-name "box",
:style ui/input,
:placeholder "task content",
:value (:draft states),
:on-change (fn [event]
(update-states! (fn [s] (assoc s :draft (.. event -target -value)))))})
(=< (j/obj :w 8))
(button
{:style ui/button,
:on-click (fn []
(when (not (string/blank? (:draft states)))
(dispatch! :create (:draft states))
(update-states! (fn [s] (assoc s :draft "")))))}
"Add"))))
Public APIs:
reacher.core/div
reacher.core/span ; and more
reacher.core/tag*
reacher.core/use-dispatch
reacher.core/use-states
Based on calcit-workflow.
MIT
Can you improve this documentation? These fine people already did:
jiyinyiyong & ChenYongEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close