Meteorux? Reduxor? Let's find out!
Let's find out!
If you don't know what Redux is, take a look at this link.
Here we imitate store behaviour using a ReactiveDict.
The only way to mutate the state is to emit an action, an object describing what happened.
@see client/templates/body.js and @see actions/counter.js
Here we delegate dispatch behavior to Meteor.methods(), it is already a Observer implementation and state can be async and handled by server computations.
Mutations are written as pure functions.
Here there is a gap, a huge one. Reducers aren't simple pure functions, since they are Meteor.methods they can handle persistent data. This persisted (or not) state is returned and passed to equivalent ReactiveDict storage key that being a reactive source, Blaze templates as reactive computations can listen the new state by the helpers and update the UI.
The idea is to use Redux principles not it's library. It's for matching Redux methodology within Meteor helping to avoid Session abuse, manage application state with a single source of truth and data flow.
Please, note that Redux itself enables awesome features like time traveling, but it is not the idea, it's a consequence.
If you are willing to use Redux itelf, take a look at this projects: