Predictable state management for glimmer apps
yarn add glimmer-redux
yarn add rollup-plugin-glimmer-redux
Open the ember-cli-build.js file and add the rollup plugin
let app = new GlimmerApp(defaults, {
rollup: {
plugins: [
glimmerRedux()
]
}
});
Open the config/environment.js file and register the reducer type
Add a reducer directory with an index.js file
//src/reducers/index.js
import { combineReducers } from 'redux';
const number = (state, action) => {
// ...reducer code
};
export default combineReducers({
number
});
https://github.com/glimmer-redux/glimmer-redux-example
import { connect } from 'glimmer-redux';
const stateToComputed = state => ({
up: state.number.up
});
const dispatchToActions = dispatch => ({
update: () => dispatch({type: 'ADD'})
});
export default connect(stateToComputed, dispatchToActions)();
-
Install the redux dev tools extension.
-
Enjoy!
yarn
ember test
Copyright © 2017 Toran Billups http://toranbillups.com
Licensed under the MIT License