Closed rbrahul closed 8 years ago
createPersistentStore
should only receive your reducer and initialState.
you probably need to pass your middleware to the compose
with which you create createPersistentStorage
here's how i made it work with redux dev-tools:
const createPersistentStore = compose(
persistState(),
window.devToolsExtension ? window.devToolsExtension() : f => f
)(createStore);
const store = createPersistentStore(reducer, initialState);
Hi @rbrahul,
Redux-localstorage was missing support for createStore's third "enhancer" argument. This has been fixed in 1.0.0-rc5; the code you had should work now.
I would however recommend sticking to one convention when it comes to enhancing your store (either through functional composition or by using the enhancer argument), e.g.:
const store = createPersistentStore(
connectApp,
initialState,
compose(
applyMiddleware(...middleware),
extension,
persistState()
)
);
export default store;
I am trying to use a custom middleware in store in following process. It's not working. Can you please suggest how to add custom middleware? Thanks in advance