Instead of using vars in React Native Hiccup, it would be interesting to use keywords.
Consider the way things are currently done:
(def ReactNative (js/require "react-native"))
(def text (r/adapt-react-class (.-Text ReactNative)))
(defn greeting []
[text "Hello"])
It would be nice to use :text
instead:
(defn greeting []
[:text "Hello"])
This might make it a little easer to treat and test views as data.
The namespace below shows an abuse of reagent.impl.template/tag-name-cache
to achieve this via
(defn register-tag [k v]
(gobj/set reagent.impl.template/tag-name-cache k v))
in the main namespace generated via re-natal
. The revisions involve the register-tag
function and its use, along with revising the Hiccup in app-root
to use keywords.