Predictable state management for ember apps
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
addon es2015Class: WrappedComponent prototype injection now plays nice w/ e… Apr 15, 2018
app [REDUX]: combineReducers is now required from app/reducers/index.js Aug 20, 2017
blueprints/ember-redux DEPENDENCY: completely remove the transitive dependency applause Jun 19, 2018
config DEPENDENCY: update to ember/ember-cli v3.4 Sep 8, 2018
docs Update Slack to Discord Sep 18, 2018
tests DEPENDENCY: update to ember v3.2.0 Jun 12, 2018
vendor Initial Commit from Ember CLI v1.13.13 Jan 22, 2016
.editorconfig [DEPENDENCY]: upgraded to ember-cli@2.8.0 Sep 23, 2016
.ember-cli Initial Commit from Ember CLI v1.13.13 Jan 22, 2016
.eslintignore DEPENDENCY: updated ember/ember-cli to v3.3.0 Jul 20, 2018
.eslintrc.js DEPENDENCY: updated ember/ember-cli to v3.3.0 Jul 20, 2018
.gitignore DEPENDENCY: updated ember/ember-cli to v3.3.0 Jul 20, 2018
.npmignore DEPENDENCY: updated ember/ember-cli to v3.3.0 Jul 20, 2018
.travis.yml DEPENDENCY: update to ember/ember-cli v3.4 Sep 8, 2018
.watchmanconfig Initial Commit from Ember CLI v1.13.13 Jan 22, 2016
CHANGELOG.md RELEASE: v4.0.0 changelog entry Jun 10, 2018
LICENSE [init]: updated the package.json/readme/license Jan 22, 2016
LICENSE.md [BUILD]: updated to ember-cli 2.4.2 Mar 26, 2016
README.md README: update from var -> const Jul 29, 2018
ember-cli-build.js DEPENDENCY: upgrade to ember-cli v2.18 Jan 13, 2018
index.d.ts [TYPES]: updated TypeScript index.d.ts to reflect v3.0.0 Aug 20, 2017
index.js DEPENDENCY: upgrade to ember-cli v2.18 Jan 13, 2018
package.json DEPENDENCY: update to ember/ember-cli v3.4 Sep 8, 2018
testem.js DEPENDENCY: updated ember/ember-cli to v3.3.0 Jul 20, 2018
yarn.lock DEPENDENCY: update to ember/ember-cli v3.4 Sep 8, 2018

README.md

Ember Redux

Travis Code Climate Score npm package

Predictable state management for ember apps

Installation

ember redux requires ember-cli v2.4+ and node 6+

ember install ember-redux

Documentation and Examples

https://ember-redux.com

Demo

Counter https://ember-twiddle.com/5bee7478e4216abe49f1c0a439bae352

TodoMVC https://ember-twiddle.com/4bb9c326a7e54c739b1f5a5023ccc805

Usage

Container Component

import Ember from 'ember';
import hbs from 'htmlbars-inline-precompile';
import { connect } from 'ember-redux';
import getUsersByAccountId from '../reducers';
import fetch from 'fetch';

const stateToComputed = (state, attrs) => ({
  users: getUsersByAccountId(state, attrs.accountId)
});

const dispatchToActions = (dispatch) => ({
  remove: (id) => fetch(`/api/users/${id}`, {method: 'DELETE'}).then(fetched => fetched.json()).then(response => dispatch({type: 'REMOVE_USER', id: id}))
});

const UserListComponent = Ember.Component.extend({
  layout: hbs`
    {{yield users (action "remove")}}
  `
});

export default connect(stateToComputed, dispatchToActions)(UserListComponent);

Presentation Component

import Ember from 'ember';
import hbs from 'htmlbars-inline-precompile';

const UserTableComponent = Ember.Component.extend({
  layout: hbs`
    {{#each users as |user|}}
      <div>{{user.name}}</div>
      <button onclick={{action remove user.id}}>remove</button>
    {{/each}}
  `
});

export default UserTableComponent;

Composition

{{#user-list accountId=accountId as |users remove|}}
  {{user-table users=users remove=remove}}
{{/user-list}}

How do I enable time travel debugging?

  1. Install the redux dev tools extension.

  2. Enjoy!

Running Tests

yarn
ember test

License

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

Licensed under the MIT License