Fork me on GitHub

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


passing atoms as arguments will not save you from using static mixin,


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


making them rerender only when their arguments change.


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


this I think works in the same way in rum and reagent


and it is not related to atoms or something similar, it is just the default behavior


From here I understand that Reagent checks for equivalence in the should-component-update-method


so, reagent has the static mixin behavior by default


or something similar


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 is about arguments and reactive is about watching atom changes


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