use lets in subscriptions in the todomvc example
This commit is contained in:
parent
5f4f902a39
commit
87cd7a4c0f
|
@ -93,16 +93,18 @@
|
|||
:done
|
||||
(fn
|
||||
[db _]
|
||||
(reaction (->> @(subscribe [:items])
|
||||
(filter :done)
|
||||
count))))
|
||||
(let [items (subscribe [:items])]
|
||||
(reaction (->> @items
|
||||
(filter :done)
|
||||
count)))))
|
||||
|
||||
(register-sub
|
||||
:active
|
||||
(fn
|
||||
[db _]
|
||||
(reaction (- (count @(subscribe [:items]))
|
||||
@(subscribe [:done])))))
|
||||
(let [items (subscribe [:items])
|
||||
done (subscribe [:done])]
|
||||
(reaction (- (count @items) @done)))))
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue