Redux is so popular, and it really can handle component state pretty well, but after working around with large scale project, it seems not as good as it’s promising.
#What’s the problem
##1. Reusability
All reducers is a pure function which is really great, which makes all reducers composible, predictable. However, the switch case statement in reducer ruined all those good parts from pure function.
Switch cases make function multiple purpose, which breaks both single responsibility and open close principle. Breaking the principles means it’s hard to compose and reuse any data flow(tiny reducer) in switch cases.
##2. Asynchronous actions While you’re programming in javascript, you can’t avoid async function, such as callback or promise. But with pure function reducer, it’s hard to reduce a asynchronous function into a value and return it synchronously.
#What can we do
Instead of imperative dispatch action or setState, simply describe something react to user or data change is always more predictable than imperative changing something. Because when you describing, you already predicted.
##Declaritive Declarative means data flow is
##Monadic Flatmap is magic, and
##Higher order component Abstract state out of our component, it’s like function composition, hoc make component composible
TODO
So if you’re interesting in this prototype, give react-most a try, eventhough