Created
May 18, 2017 09:58
-
-
Save stevermeister/264750ace5e45bd4ee041d9656b49ab8 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
function createStore(reducer, initialState) { | |
var currentReducer = reducer; | |
var currentState = initialState; | |
return { | |
getState() { | |
return currentState; | |
}, | |
dispatch(action) { | |
currentState = currentReducer(currentState, action); | |
return action; | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment