As an exercise I ported the Om tutorial to Reagent. It's available at https://github.com/jonase/reagent-tutorial
I hope you find it interesting.
Jonas
Jonas
--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.
/dan
So if I understand correctly the 'app' arg in (defn contacts-view [app owner] ...) doesn't have to be the root of the app-state atom?
On Saturday, January 25, 2014 9:49:56 AM UTC+2, David Nolen wrote:So if I understand correctly the 'app' arg in (defn contacts-view [app owner] ...) doesn't have to be the root of the app-state atom?
> Nice. I do consider the non-modularity of `update-contacts!` here to be one of the big things I try to address in Om. The Reagent `update-contacts!` knows too much. In Om, it doesn't matter at all where :contacts lives in the app state, the Om contacts-view can still update it.
Interesting! I can definitely see how UI components directly manipulating global state can make reuse difficult.
I guess this is not really an issue in React as their components have local state (via getInitialState). It's possible to work with local state in Reagent as well so reusable components are not completely out of the picture.
It's great if Om can work with global state without hindering reuse. That means you can (for example) update :contacts without going via the UI components at all (perhaps pushed to you from the server).
On Sat, Jan 25, 2014 at 12:34 PM, Jonas Enlund <jonas....@gmail.com> wrote:Interesting! I can definitely see how UI components directly manipulating global state can make reuse difficult.
I guess this is not really an issue in React as their components have local state (via getInitialState). It's possible to work with local state in Reagent as well so reusable components are not completely out of the picture.
It is an issue if you want modular time management. The undo example for Reagent is not modular. All time management in Om is designed to work across any configuration of components embedded in whatever way you please.
Well, that depends on your definition of "modular", doesn't it :)
It is "modular" in the sense that it is isolated from the rest of the page, which is (I suppose) sort of the opposite of your idea of modular...
Well, that depends on your definition of "modular", doesn't it :)If I can't include somebody's component and apply time management to it, that's sounds unambiguously "non-modular" with respect to *time management*.
It is "modular" in the sense that it is isolated from the rest of the page, which is (I suppose) sort of the opposite of your idea of modular...
I think I was careful to say modular with respect to something specific earlier :)In Om we get the same basic component modularity offered by React and Reagent but we also get a whole new kind modularity because Om was designed that way after a fairly serious assessment of the React model.
On 25 jan 2014, at 20:50, David Nolen <dnolen...@gmail.com> wrote:
On Sat, Jan 25, 2014 at 1:55 PM, Dan Holmsand <holm...@gmail.com> wrote:Well, that depends on your definition of "modular", doesn't it :)If I can't include somebody's component and apply time management to it, that's sounds unambiguously "non-modular" with respect to *time management*.I meant that you may not *want* to let "time management" of one component influence undo functionality of another. I think there is value in having both "integrated modules" (w.r.t for example time management), and "isolated modules", and that the line between the two may not always be very clear.
Oooh, I didn't in any way mean to say that Om is anything but extremely cool. The invention of a whole new way of handling state in client apps doesn't happen every day. Probably not even every decade.I'm just trying to defend my little creation :)
There are a couple of rough spots (as there are with all wrappers currently, and with React itself) - but they're notably of the superficial & correctable-in-time variety (IMO).
I wouldn't normally advocate so strongly for something (certainly not repeatedly), but I feel inclined to here since I don't personally believe it's accurate to characterise the choices made by Reagent as in any way wrong or inferior. They're offering up a different set of tradeoffs that some might find beneficial.
Indeed, I think it'd be premature to make any strong statements at this point since so much of our development model has recently been thrown up in the air with the advent of tool combinations like Cljs + core.async + React, and the fantastic new patterns they enable. It's just way too early to be critical of new ideas at this point.
Anyway, Dan's a relatively new member of our community and I'd be sad if he felt discouraged from pursuing his ideas.
I'd encourage anyone following these discussions to check out the relevant examples and decide what makes sense for your own requirements and taste.
Tl;dr - let's try things, let's share the best of them, and let's build great stuff. Kumbaya and all that. Okay, I'll shut up now.
Peace :-)
I added a section in the README where I try to explain each part of the program. If you (or someone else) find any errors in the explanations I'd like to fix them. Bug me here or open an issue (or pull request) on Github.
I find Reagent very easy and intuitive to work with. Next, I will make a more serious attempt at understanding the Om model which seems equally interesting.
All the innovation currently going on in the CLJS community is awesome and I think that both Om and Reagent is heading in the right direction.
Jonas
Can I get a bit of clarification on this: The above suggests an anti-pattern but isn't the idea that app state be manipulated using om/update! or om/transact! both of which must be called inside a component function?
Or are you suggesting that it is the passing of the entire app-state to a component rather than a specific cursor that is the anti-pattern?