I have been using Clojure, ClojureScript, lein, shadow-cljs, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project.
The project heavily uses Re-frame. According to the official documentation, everything is on the data-driven architecture.
A UI is just derived data.
A browser renders tree-shaped data called the DOM. Reagent renderers create DOM by computing hiccup-shaped data. Subscriptions deliver data to Reagent renderers. And, app-db is the root of this entire flow.
Hence, I was expecting direct calls to app-db
on the project. Or at least some mention on the source code. However, there is not a single direct call or mention of any kind to app-db
. I must highlight that this is a large and professional project being used by paid customers.
Is this behavior expected? Is it a good (or the only possible) practice?
Are only reg-sub
and subscribe
the ways to indirectly access app-db
?
Yes, you are not expected to touch app-db
directly. All re-frame
functions use it internally and you should use those.