Я пытаюсь использовать неизменяемый по редуксу с , сохраняющий избыточность .
Я много искал, но не нашел решений для решения этой проблемы.
store.js:
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'remote-redux-devtools';
import logger from 'redux-logger';
import { createEpicMiddleware } from 'redux-observable';
import immutableTransform from 'redux-persist-transform-immutable';
import { persistStore, persistReducer } from 'redux-persist';
import { combineReducers } from 'redux-immutable';
import { Map } from 'immutable';
import { routerReducer } from 'react-router-redux';
import storage from 'redux-persist/lib/storage';
import createFilter from 'redux-persist-transform-filter';
import epics from './epics';
import reducers from './reducers';
const middlewares = [createEpicMiddleware(epics), logger];
const composeEnhancers = composeWithDevTools({ realtime: true, port: 8000 });
const saveSubsetFilter = createFilter(
'Login',
['userData'],
);
const persistConfig = {
key: 'reduxStore',
storage,
transforms: [saveSubsetFilter, immutableTransform()],
};
const initialState = Map();
const persistedReducer = persistReducer(persistConfig, combineReducers({
...reducers,
routing: routerReducer,
}));
export const store = createStore(
persistedReducer,
initialState,
composeEnhancers(applyMiddleware(...middlewares)),
);
export const persistor = persistStore(store);
Мои ошибки в консоли:
The previous state received by the reducer is of unexpected type. Expected argument to be an instance of Immutable.Collection or Immutable.Record with the following properties: "Login", "Campaigns", "Websites", "routing".
Uncaught TypeError: inputState.withMutations is not a function
Примечание:
У меня не было ошибок перед добавлением redux-persist
.
Пожалуйста, помогите мне, если у вас есть идеи.