Last active
August 19, 2016 18:52
-
-
Save deebloo/cba2b70a90925676591164a917b30e89 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { createStore } from 'redux'; | |
const add1 = () => { | |
type: 'ADD1', | |
payload: state => [{}, ...state] | |
} | |
const add2 = () => { | |
type: 'ADD2', | |
payload: state => add1().payload(add1().payload(state)) | |
} | |
const add3 = () => { | |
type: 'ADD3', | |
payload: state => add2().payload(add1().payload(state)) | |
} | |
const store = (state = [], action) => { | |
case ADD1: | |
case ADD2: | |
caase ADD3: | |
return action.payload(state); | |
default: | |
return state; | |
}; | |
store.dispatch(add3()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment