freactive是一个高性能、纯Clojurescript实现的声明式DOM库。使用hiccup风格的语法和Clojure内建的deref和atom模式。灵感来自于reagent,om和reflex
示例代码:
(nsexample1(:refer-clojure:exclude[atom])(:require[freactive.core:refer[atomcursor]][freactive.dom:asdom])(:require-macros[freactive.macros:refer[rx]]))(defoncemouse-pos(atomnil))(defnview[][:div{:width"100%":height"100%":style{:border"1pxsolidblack"}:on-mousemove(fn[e](reset!mouse-pos[(.-clientXe)(.-clientYe)]))}[:h1"HelloWorld!"][:p"Yourmouseisat:"(rx(str@mouse-pos))]])(defonceroot(dom/append-child!(.-bodyjs/document)[:div#root]))(dom/mount!root(view))
评论