Add missing handler to "Loading Initial Data" doc

"The pattern" implies `:initialise-db` handler, but it is missing. This PR adds a very simple implementation.
This commit is contained in:
Dmitry Groshev 2016-08-30 20:18:42 +03:00 committed by GitHub
parent 005f76c0a6
commit 1e2c6703f5

View File

@ -136,6 +136,11 @@ quick sketch of the entire pattern. It is very straight-forward.
(fn [db _]
(not (empty? db)))) ;; do we have data
(re-frame/reg-event-db
:initialise-db
(fn [db _]
(assoc db :display-name "Jane Doe")))
(defn main-panel ;; the top level of our app
[]
(let [name (re-frame/subscribe :name)] ;; we need there to be good data