But there is transient state and state that you care to keep.

I'm not sure why you would want to put transient state like keyboard input
into global state before you actually need to transition app state. At that
point grab the input component state and put it in global state, then
transition, and now you can undo and redo.


On Tue, Mar 17, 2015 at 8:46 PM, Mike Thompson <m.l.thompson...@gmail.com>
wrote:

> On Wednesday, March 18, 2015 at 1:09:12 PM UTC+11, Mike Haney wrote:
> > In my experience, using component local state seems harmless enough in
> the beginning, but I almost always find a need to move it to global state
> as an app matures.  A few common examples:
> >
> > - text input: local state works great until you start to add validation,
> then it is usually better to have it in global state.  Also, clearing form
> fields on submission is easier to handle with global state.
> >
> > - loading indicators: local state works fine, until you start handling
> network errors and have to clear the loading indicator when there's an
> error.
> >
> > - collapsed/hidden flags: for drop down menus, nav drawers, etc.  Again,
> it's easier to use global state so you can do things like close the menu
> when the user clicks away from it (a pet peeve of mine are menus that can
> only be closed by clicking on the menu itself - argh!).
> >
> > I'm finding that most of these things become ridiculously easy with
> re-frame.  Simple example - create a "menu-closing" handler middleware and
> attach it to any handlers where you want the menu to close.
>
>
> Yes, indeed. Synchronizing state is a fraught process. Keep it in the one
> place if you can. http://martinfowler.com/bliki/TwoHardThings.html
>
> --
> 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.

Reply via email to