This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-15
Channels
- # aleph (14)
- # aws (5)
- # beginners (144)
- # bitcoin (1)
- # boot (14)
- # chestnut (13)
- # cljs-dev (58)
- # cljs-experience (1)
- # cljsrn (47)
- # clojure (107)
- # clojure-dev (9)
- # clojure-finland (12)
- # clojure-gamedev (4)
- # clojure-russia (2)
- # clojure-sanfrancisco (1)
- # clojure-spec (5)
- # clojure-uk (28)
- # clojurescript (34)
- # cursive (9)
- # datomic (3)
- # emacs (11)
- # garden (16)
- # graphql (9)
- # hoplon (3)
- # jobs (2)
- # juxt (6)
- # off-topic (32)
- # om (10)
- # onyx (1)
- # pedestal (4)
- # proton (1)
- # re-frame (14)
- # reagent (8)
- # ring (1)
- # ring-swagger (34)
- # shadow-cljs (19)
- # sioux-falls (1)
- # spacemacs (16)
- # testing (14)
@erwinrooijakkers app-db
will be an input Signal to that reaction
. Any change to an input Signal, will trigger a re-run of the reaction
. So any change whatsoever to app-db
will trigger a re-run.
Okay thanks! So it will run on EVERY change to app-db
? Not only a change to the result of the query on app-db
?
I did see that I have to use the reaction
in a component, when I take the reaction as a parameter to a component the component is not updated on a change. E.g.,
(defn inner-component [reaction-state] (fn [reaction-state) <does not rerender on change to reaction-state>))
(defn wrapper-component [] (let [screen-state (reaction ...)] (fn [screen-state] [inner-component screen-state])))
The inner-component
does not rerender on a change to screen-state
.@erwinrooijakkers I think the brief explanation is thus: if you deref something inside a component, the component is only re-rendered once the resulting value from the deref returns something different from previous derefs.
something here could mean both an r/atom
, a r/reaction
or a r/cursor
(and maybe r/track
, I don’t have a full overview of the many flavors of dereffable “reaction-likes”)
And likewise, a reaction body will be run if the dereffable(s) it derefs result in new values - but it might be that the product of running the reaction body is the same value as before, meaning that the deref of the reaction does not cause a re-render
This is my understanding, I hope that it is correct 😄
Thanks! Mine as well 🙂