Created
January 8, 2017 04:27
-
-
Save atticoos/d1b0679c271db0228c23c8221a99449a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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