/glimmer-redux-1

Predictable state management for glimmer apps

Primary LanguageJavaScriptMIT LicenseMIT

Glimmer Redux

Predictable state management for glimmer apps

Installation

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
});

Example

https://github.com/glimmer-redux/glimmer-redux-example

Usage

import { connect } from 'glimmer-redux';

const stateToComputed = state => ({
  up: state.number.up
});

const dispatchToActions = dispatch => ({
  update: () => dispatch({type: 'ADD'})
});

export default connect(stateToComputed, dispatchToActions)();

How do I enable time travel debugging?

  1. Install the redux dev tools extension.

  2. Enjoy!

Running Tests

yarn
ember test

License

Copyright © 2017 Toran Billups http://toranbillups.com

Licensed under the MIT License