This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (91)
- # cider (1)
- # cljsjs (29)
- # cljsrn (8)
- # clojure (51)
- # clojure-berlin (1)
- # clojure-india (1)
- # clojure-russia (26)
- # clojure-spec (15)
- # clojure-uk (1)
- # clojurebridge (1)
- # clojurescript (240)
- # code-reviews (1)
- # cursive (22)
- # datomic (3)
- # editors (6)
- # emacs (24)
- # figwheel (3)
- # lein-figwheel (57)
- # off-topic (4)
- # om (3)
- # proto-repl (7)
- # protorepl (8)
- # reagent (2)
- # rum (23)
- # slack-help (1)
- # spacemacs (2)
Any idea whether it's better to try to give most arguments as atoms and use the reactive mixin, or try to use immutable data structures and the static mixin?
My guess would be that the reactive mixin offers better performance, since Rum doesn't have to do an equivalence check on every component, but I'm just guessing
because if some top component need rerender will cause whole tree rerender that is something you may don't want...
On my apps I'm using two approaches, for big page like components I use reactive mixin and just take the atoms/refs from the namespace where they are definen. For small reusable components I'll try to use static+immutable data structures as arguments
Why does a top level component cause all child components to rerender? Wouldn't Rum know that they don't need to be rerendered? I think Reagent does, so I expect to Rum to know too
I could be mistaken - it's hard to tell what exactly causes a component to re-render, unless you have logging that explicitly tells you that..
if you don't use the static mixin, the shouldComponentUpdate by default is true, (the reacts default), so if something in top level component is changed, it will trigger the
render of each child component, unless the shouldcomponentupdate returns false
From here I understand that Reagent checks for equivalence in the should-component-update-method
So I guess in Rum, if I have a component that gets all its arguments in an atom, and I want to react to changes in that atom, I should in fact use both the static and the reactive mixin..
Reactive mixin for reacting to changes in the value of the atom, and static for telling the component only to re-render when it gets a different atom as arguments
static mixin checks the arguments and decides if it need render or not based on equality
so if some toplevel is need to be rerender it will call the child component with the same atom, then, the child component not will be rerendered