This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-19
Channels
- # beginners (240)
- # boot (9)
- # braveandtrue (2)
- # bristol-clojurians (2)
- # cider (2)
- # cljsrn (84)
- # clojars (1)
- # clojure (195)
- # clojure-belgium (9)
- # clojure-china (5)
- # clojure-denmark (4)
- # clojure-italy (7)
- # clojure-mke (1)
- # clojure-norway (1)
- # clojure-russia (16)
- # clojure-spec (74)
- # clojure-uk (15)
- # clojurescript (78)
- # clr (3)
- # code-reviews (4)
- # datascript (8)
- # datomic (71)
- # emacs (9)
- # hoplon (18)
- # jobs (3)
- # kekkonen (32)
- # klipse (19)
- # lambdaisland (2)
- # luminus (15)
- # off-topic (6)
- # om (35)
- # om-next (62)
- # onyx (17)
- # overtone (5)
- # pedestal (1)
- # perun (1)
- # planck (31)
- # protorepl (1)
- # re-frame (135)
- # reagent (34)
- # ring-swagger (6)
- # rum (54)
- # specter (3)
- # untangled (14)
- # yada (14)
The only problem with using re-frame with Rum is that re-frame has a hard dependency on Reagent's atoms and reactions
There are a number of libraries already that you could use to replace Reagent if you want to do that
It seems most libraries that give your client code some structure depend on Reagent for the atoms/reactions. It's a shame, but understandable. I know only of @metametadata's excellent #carry library which doesn't rely on Reagent š https://github.com/metametadata/carry
All of these libraries are quite similar. One big difference, if we compare carry and re-frame, is that Carry doesn't have global state, instead all view-functions get their data as an argument. Re-frame's global state has the disadvantage of added "magic", but it can have better performance due to how React works.
If I understand React correctly, because re-frame components don't get arguments, we can completely skip the should-component-update
calls, and we avoid situations where we re-calculate a component because its arguments change, but in fact it wouldn't have to change.
When we give the model as an argument, the least React will have to do is call should-component-update
on our components. Needless re-calculations are avoidable, but due to programmer error we'll likely have some.
By re-calculation I mean that React calls the render functions to get the new hiccup, or whatever format we use š
@metametadata, yes several instances of pure-frame that talk to each other sounds great
@metametadata, from your first comment, it is not clear but I think pure-frame has no global state, thatās the point
@metametadata thanks for Elm link, looks interesting
@kauko "re-frame components don't get argumentsĀ Ā» ? Iām not sure about that, is it like reagent components? take props as 1st arguments and follow the react lifecycle if it changes? reagent is a bit messy for that I think, if props changes, lifecycles methods are called but not if a ratom is changingā¦ can be troubling at first...
In re-frame you don't typically give arguments to your view functions, instead you use the subscriptions and whatnot.
And about the "ratom is changing" thing: lifecycle methods are called even when your argument is an atom (or a reagent/atom), but atoms are not compared by their contents. Instead, you just check whether it's the same atom or not.
@kauko here's what i tried to explain š from https://github.com/Day8/re-frame/wiki/When-do-components-update%3F Lifecycle Functions When props change, the entire underlying React machinery is engaged. React Components can have lifecycle methods like component-did-update and these functions will get called, just as they would if you were dealing with a React Component. But ... when the rerender is re-run because an input ratom changed, Lifecycle functions are not run. So, for example, component-did-update will not be called on the Component. Careful of this one. It trips people up.
maybe it is specific to re-frame, I believed it comes from reagent docs, not re-frame
Hmm I don't know what reagent/children
does actually. It sounds like it would return the child components, but the docstring says Returns the children passed to a component.
Huh, I think you're right. It looks like with React.js you always give one props
object to a component.
@pbaille yeah, I wanted to say that pure-frame doesn't define a global model var, but it probably still gravitates towards the usage of a single model per the application.
@metametadata, I donāt know, I have to do experiments on combining āframesā together, sounds fun to try.
Did some work today consolidating global state in re-frame: https://github.com/martinklepsch/re-frame/pulls ā I'd eventually like to be able to use all but the subscription stuff with Rum (and perhaps other React wrappers) but that will probably take quite a bit longer š