![]() ![]() It's interesting to see what solutions will emerge eventually. ![]() In general, I think this is a real problem and it's not a surprise that it appears again and again. So it is interesting how they deal with "replay" feature in such cases - asked them in day8/re-frame#86 is an example of different approach where they have single event handler which acts as the only FSM.īut then reducers have side effects. All of existing examples just do not have complex control logic, so this problem is somewhat hidden. But when you have complex control logic it may become problematic. I'd say that this Flux approach handles the majority of use-cases of typical web app very well. So your control flow is effectively split into two state machines and one of them is implicit and full of side effects. If it is not currently "submitting" - then send HTTP request and dispatch one action, otherwise - just do nothing or even dispatch different action (like warning). In current model your action creator will have to choose what actions to dispatch depending on current state. First time you will send HTTP request to the server (in the action creator) and change state to "submitting" (in the reducer). I would argue that while reducers are state machines, so are action creators in general (but implicitly). Reducers are just state machines and have nothing to do with async. toggleLoginState ( ) // Doesn't care how it happensĪction creators and middleware are designed to perform side effects and complement each other.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |