Last active
May 6, 2020 05:49
-
-
Save Scarysize/66639479cae665bdf65d929945a47236 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
import {applyMiddleware, createStore, combineReducers} from 'redux'; | |
import {createSyncMiddleware} from '...somewhere'; | |
export default function initStore(socket) { | |
let middelware = applyMiddleware(/* redux-logger, thunk etc.*/); | |
if (/* check if this is the 'leader' */) { | |
middleware = applyMiddleware(createSyncMiddleware(socket), /* other middlware*/); | |
} | |
return createStore( | |
combineReducers({/* your reducers */}), | |
middleware | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment