There are a few libraries available that provide alternatives to om.dom.
Om-tools is a library by Prismatic to make writing Om components easier.
First, in project.clj
, add om-tools
as a dependency
:dependencies [;; ...
[prismatic/om-tools "0.3.9" :exclusions [potemkin]]]
In core.cljs
, replace [om.dom :as dom :include-macros true]
with
[om-tools.dom :as dom :include-macros true]
[om-tools.core :refer-macros [defcomponent]]
If you still have a freshly generated Chestnut app, the only further change you need to do is remove the nil
in (dom/h1 nil (:text app))
.
Compared to om.dom
, om-tools.dom
does three things different for a cleaner syntax.
nil
is no longer necessary), and can be Clojurescript maps. So the #js
reader macro is not needed:className
instead of :class
, :onClick
instead of :on-click
apply
to when setting a collection as children of an elementHave a look at the om-tools.dom docs for more examples.
Sablono provides Hiccup-style templating for Om.
First, in project.clj
, add sablono
as a dependency
:dependencies [;; ...
[sablono "0.2.22"]]
In core.cljs
, replace [om.dom :as dom :include-macros true]
with
[sablono.core :as html :refer-macros [html]]
This h1
definition
(dom/h1 nil (:text app))
becomes
(html [:h1 (:text app)])
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close