Created
June 12, 2016 18:33
-
-
Save markerikson/a890c9d8f43ceb8bb37f4a9a64b4b4b9 to your computer and use it in GitHub Desktop.
Store Enhancer example
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 default function applyMiddleware(...middlewares) { | |
return (createStore) => (reducer, preloadedState, enhancer) => { | |
// snip actual enhancer logic | |
return { | |
...store, | |
dispatch | |
} | |
} | |
} | |
const middlewares = [thunk, myMiddleware]; | |
const middlewareEnhancer = applyMiddleware(...middlewares); | |
const enhancers = compose(middlewareEnhancer, someOtherEnhancer); | |
const store = createStore(reducer, preloadedState, enhancers); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment