> itself in the right absolute position if the window resizes). Its > not that you can't do this in OM, of course, but, as I understand it, > you'd have to merge the window dimensions into the main atom, and > meaning the "reusable" popup component would require that every > app-state had these window dimensions at the same place (cursor). > Feels a bit hacky to me. (If I've lead you astray here, and there's > a better way to create such a reusable component in OM, I hope > someone will correct me.)
Each Om component has local component state, just as in React. You certainly don't have to merge everything into the global app data as you describe, and UI concerns like this are exactly the use-case for local state. This is all described in the tutorials and docs. https://github.com/swannodette/om/wiki/Documentation (2014/06/23 9:30), Mike Thompson wrote: > On Monday, June 23, 2014 1:32:27 AM UTC+10, Jonathon McKitrick > wrote: >> On Friday, June 20, 2014 10:29:38 AM UTC-4, Jonathon McKitrick >> wrote: >>> I discovered that along with Om, there are Reagent and >>> Quiescence. >>> >>> Has anyone worked with the latter alternatives, and how might I >>> decide what the tradeoffs are for using each of them? >> >> So tell me if this is accurate.... >> >> In a nutshell: 1. Reagent has the simplest approach, with just the >> 'render' function for React.js components, and a ratom (possibly >> one per component) for state. > > Reagent starts simple, but handles more sophisticated situations > pretty well, IMO. Components can depend on more than one atom, if > required. > > For example, if your component is absolutely positioned (a pointing > popup which has another element as its anchor), then its absolute > positioning will be dependent on the window size. If the user > resizes, then the popup's absolute positioning changes. > > In such a case, it is easy to make your reusable reagent popup > component dependent on two atoms ... one for the program state, and > one representing the current size of the window. (It re-renders > itself in the right absolute position if the window resizes). Its > not that you can't do this in OM, of course, but, as I understand it, > you'd have to merge the window dimensions into the main atom, and > meaning the "reusable" popup component would require that every > app-state had these window dimensions at the same place (cursor). > Feels a bit hacky to me. (If I've lead you astray here, and there's > a better way to create such a reusable component in OM, I hope > someone will correct me.) > > Anyway, that's just one example. > > It was this (elegant!) gist that won me over to reagent (thank you > allgress!!): https://gist.github.com/allgress/11348685 > > OM gets all the love and attention in this group but I personally > find reagent more elegant, scalable, testable and powerful. But with > all the energy apparently flowing towards OM, I keep on asking myself > what I'm missing. :-) > > I'm very much looking forward to David Nolen's upcoming release of > the CLJS logic database which might well change everything (again). > Does anyone else find the pace of change brutal these days? So many > learning curves. > > -- Mike > > > > -- 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.
