Minh Tran & David Humphreys
Just patterns*
(* with some code attached)
Large-scale code exaggerates problems
Some patterns emerge
Better patterns (not more!)
(defn widget [prop1 prop2] (fn render [prop1 prop2] [:div (if (:a @prop1) ...)]))
(defn widget [prop1 prop2] (let [val (reaction (:a @prop1))] (fn render [prop1 prop2] [:div (if @val ...)])))
Won't work this way.
[Reagent remains on stage]
(dispatch [:go-to-page "/page-one/"])
fire & forget
(register-handler :go-to-page [middleware] (fn [db [action page-url]] ;;mutate the snapshot db))
pure handlers please
(register-sub :active-page (fn [db _] ;;computation on the app-state (reaction (:active-page @db))))
Transform the messages