On Saturday, January 25, 2014 5:38:14 PM UTC+2, David Nolen wrote:
> On Sat, Jan 25, 2014 at 3:57 AM, Jonas Enlund <[email protected]> wrote:
> 
> 
> 
> 
> On Saturday, January 25, 2014 9:49:56 AM UTC+2, David Nolen wrote:
> 
> > 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.
> 
> 
> 
> 
> 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?
> 
> 
> It can be at any location in the app state and it will always work. This is 
> important for component composition and re-usability.
> 
> 
> 
> If I was to describe the difference between Om and Reagent it would be that 
> Om is draconian about component modularity in order to encourage component 
> reuse. Directly manipulating the app state from a component in Om is a 
> anti-pattern. Components communicating with each other via functions is also 
> an anti pattern (use channels).

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).

I experimented a bit with moving :contacts to the server and broadcasting 
changes to all connected clients here: 
https://github.com/jonase/reagent-tutorial/tree/server

As I write in the README. It's interesting to compare these two awesome 
libraries.

Thanks,

Jonas

> 
> 
> 
> DavidĀ 

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to