Fork me on GitHub
#re-frame
<
2015-07-04
>
Petrus Theron08:07:38

How can I use the second argument to a subscription handler in re-frame? (fn [db <what's this?>] ...)

Petrus Theron08:07:37

When building reusable views, should I pass in subscriptions as arguments, or subscribe in the component?

Petrus Theron08:07:46

And where should I deref the reactive subscription?

Petrus Theron08:07:51

I.e.

(defn child-component [contacts]
 [:div "Should I deref here?" @contacts])

(defn parent-component []
(let [contacts (subscribe [:contacts])
[:div "Where should I deref contacts?"
 [child-component contacts]]))
or
(defn parent-component []
(let [contacts (subscribe [:contacts])
[:div "Where should I deref contacts?"
 [child-component @my-data]]))