Skip to content

Instantly share code, notes, and snippets.

@atticoos
Created January 8, 2017 04:27
Show Gist options
  • Save atticoos/d1b0679c271db0228c23c8221a99449a to your computer and use it in GitHub Desktop.
Save atticoos/d1b0679c271db0228c23c8221a99449a to your computer and use it in GitHub Desktop.
import {createReducer} from 'rxjs-store';
const TodoActions = {
add: newItem => items => items.concat(newItem),
remove: oldItem => items => items.filter(item => item !== oldItem);
};
const todos = createReducer(TodoActions, []);
// Pass these to a <Provider /> and you're done
const store = combineReducers({todos: todos.store});
const actions = {todos: todos.actions};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment