Hello! Sorry if this has been asked before, but I couldn't find anything. I wanted to ask about using the reagent reaction macro vs dynamic subscriptions for something like this:
(rf/reg-sub
::weather-today-impl
(fn [_ [day place]]
(rf/subscribe [::weather day place]))
identity)
(rf/reg-sub
::weather-today
(fn [_]
(rf/subscribe [::weather-today-impl]
[(rf/subscribe [::day])
(rf/subscribe [::place])]))
identity)
VS
(rf/reg-sub
::weather-today
(fn [_]
(reaction
@(rf/subscribe [::weather
@(rf/subscribe [::day])
@(rf/subscribe [::place])])))
identity)Obviously the first one is more vervose, but maybe it's more idiomatic or performant?
I'd use reg-sub-raw. Both more idiomatic and performant.
reg-sub-raw + the reaction macro?
Yep. Or a regular underefed sub since it's also a reaction.
Ok, thanks for you help!
Ah, but note that if you do deref anything, you still have to wrap everything in a reaction.