A set of Ember Template Helpers for Redux.JS
http://jkusa.github.io/ember-redux-helpers/
Helper to fetch and subscribe to state properties in the redux store
Use object paths just like you would with Ember.get
Closure action helper to dispatch directly to the redux store
{{!-- component.hbs --}}
<button onclick={{dispatch 'ADD' value=value}}>
Click to Add
</button>
//reducer.js
export default (state=0, action) => {
if(action.type === 'ADD') {
state += action.value;
}
return state;
};
Arguments provided while invoking the action can be referenced via the invocationArgs property array
//reducer.js
export default (state={}, action) => {
if (action.type === 'UPDATE') {
let { field, invocationArgs } = action;
state = Object.assign(state, {
//invocaionArgs contains the event obj
[field]: invocationArgs[0].target.value
});
}
return state;
};
This addon will work on Ember versions 1.13.x
and up only, due to use of the new Helper
implementation.
Thanks to @toranb and @rwjblue who inspired this addon.