Open JimLynchCodes opened 6 years ago
I've figure out how to use it. This error happens, when we try to add redux-localstorage to applyMiddleware function, like this:
const middlewares = applyMiddleware(
thunkMiddleware,
persistState(['cart'])
);
createStore accepts as a second parameter middlewares or an enhancer.
Then, your code would be something like this:
import { combineReducers, createStore, applyMiddleware, compose } from 'redux';
const reducers = combineReducers({
cart: cartReducer
});
const middlewares = applyMiddleware(
thunkMiddleware
);
const configureStore =
createStore(
reducers,
compose(
middlewares,
persistState(['cart'])
)
);
Pretty simple. I hope I still may help someone.
This issue can be closed.
Hi, I'm trying to add persistState , but it's giving me this error:
Here's my store.js file: