-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is index.js from branch 9-action-creators at its desired state? #3
Comments
Below is a version without the repetitive code: // Library code let state; const getState = () => state; const subscribe = (listener) => { const dispatch = (action) => { return { // App Code function addTodoAction(todo) { function removeTodoAction(id) { function toggleTodoAction(id) { function addGoalAction(goal) { function removeGoalAction(id) { // Reducer function function goals(state = [], action) { function app(state = {}, action) { const store = createStore(app); store.subscribe(() => { store.dispatch( store.dispatch( store.dispatch( store.dispatch(removeTodoAction(1)); store.dispatch(toggleTodoAction(0)); store.dispatch( store.dispatch( store.dispatch(removeGoalAction(0)); |
Starting on line 26 in
9-action-creators
, I'm seeing a number of repetitive code all jumbled together which I don't suspect is correct. Thanks!The text was updated successfully, but these errors were encountered: