Fork me on GitHub
#re-frame
<
2022-03-19
>
Dustin Paluch16:03:00

In the middle section of this https://day8.github.io/re-frame/images/subscriptions.png?raw=true, the code example for layer 3 is

(reg-sub
  :greeting
  (fn [_ _]
    (subscribe [:get-name]))
  (fn [name]
    (str "Hello " name)))
It’s not clear to me why there are two functions here.

Dustin Paluch16:03:06

ah, the docstring for reg-sub has the answer.

p-himik17:03:45

And with the recent RC, you can write it as (reg-sub :greeting :<- [:get-name] :-> #(str "Hello " %)). :)

👍 1