A non-serializable value was detected in an action, in the path: `register`. Value

20 Views Asked by At

The console is indicating this error:*A non-serializable value was detected in an action, in the path: register. Value: ƒ register(key) { pStore.dispatch({ type: constants__WEBPACK_IMPORTED_MODULE_0.REGISTER, key: key }); } Take a look at the logic that dispatched this action: {type: 'persist/PERSIST', register: ƒ, rehydrate: ƒ} reduxPersist.JS

import storage from 'redux-persist/lib/storage';
import { persistReducer } from 'redux-persist';

export default (reducers) => {
  const persistedReducers = persistReducer(
    {
      key: 'REACT-BASE',
      storage,
      whitelist: ['exempleReducer'],
    },
    reducers
  );

  return persistedReducers;
};

index.js

import { persistStore } from 'redux-persist';
import { configureStore } from '@reduxjs/toolkit';
import createSagaMiddleware from 'redux-saga';
import rootReducer from './modules/rootReducer';
import rootSaga from './modules/rootSaga';

import persistedReducers from './modules/reduxPersist';

const persistedReducer = persistedReducers(rootReducer);
const sagaMiddleware = createSagaMiddleware();

const store = configureStore({
  reducer: persistedReducer,
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware().concat(sagaMiddleware),
});

sagaMiddleware.run(rootSaga);

export const persistor = persistStore(store);
export default store;

0

There are 0 best solutions below