Last active
April 6, 2016 01:19
-
-
Save Nicktho/4c2011975a7b5f59aedf334b951defea 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
export function createStore(reducer, initialState) { | |
let currentState = initialState; | |
function getState() { | |
return currentState; | |
} | |
function dispatch(action) { | |
currentState = reducer(currentState, action); | |
} | |
dispatch({ type: 'INIT' }); | |
return { getState, dispatch }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment