The only thing novel to me (vs my own way) is that after updating state I don't have to explicitly call render on the corresponding element(s) ... it guesses by computing a diff.... but I am not sure what that buys me besides beautiful functional code ...
On Wed, Jan 21, 2015 at 5:23 PM, Mike Haney <txmikes...@gmail.com> wrote: > Always glad to help. > > Probably the biggest caveat with React is that you have to break old > habits of trying to directly manipulate the DOM, and be careful with other > libraries like jQuery that directly manipulate the DOM. It is possible to > integrate things like jQuery components with React, but it has to be done > in a specific way. > > A simple example - suppose you have a drop-down menu that is toggled > open/closed by setting a css class on the parent DOM element (pretty > standard stuff). Using something like jQuery, you would have an onClick > handler that directly adds or removes the class as needed. > > With React, you can't (easily) do that, nor should you. Instead, your > event handler would update application state, or maybe send a message to > some dispatcher that then updates state for you (depending on how > sophisticated your architecture needs to be). Your React component in this > case would check application state for this flag you have set, and add the > appropriate css class when needed. So whether or not this this css class > gets set depends on the state passed to your component at the time a render > is requested. In the case of Om and Reagent, the render would have been > triggered when you modified the state, so the results will be seen right > away. > > So with React, your entire app UI becomes a declarative specification of > what to render given a particular app state, which is refreshingly easy to > reason about. > > -- > 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 clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at http://groups.google.com/group/clojurescript. > -- 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 clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.