일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- background tab
- Nextjs React 18
- codingtest
- notFound()
- React 18 Nextjs
- Render Props
- RTK Query
- react-helmet
- getUTCDate
- background setInterval
- Javascript
- Nextjs
- react hook
- hook
- context
- background setttimeout
- next13 head
- React API 참고서
- React 고급안내서
- react
- Babel
- React 고급 안내서
- React18
- Next13
- background: url
- Programmers
- 고급안내서
- React 공식문서
- React 18
- CSS
Archives
- Today
- Total
akjfal
11/12 본문
redux startr kit + redux persist + redux saga
import { combineReducers } from "redux"
import { persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import root from './reducer'
const persistConfig = {
key:'root',
storage,
whitelist: ['state']
}
export default combineReducers({
root: persistReducer(persistConfig, root),
})
import React from "react";
import { configureStore, getDefaultMiddleware } from 'redux-starter-kit'
import { persistStore } from 'redux-persist'
import { Provider } from "react-redux";
import createSagaMiddleware from "redux-saga";
import { PersistGate } from 'redux-persist/integration/react'
import rootReducer from "./reducers";
import rootSaga from "./sagas";
const sagaMiddleware = createSagaMiddleware();
const store = configureStore({
reducer: rootReducer,
middleware: [ sagaMiddleware ]
});
sagaMiddleware.run(rootSaga);
const persistor = persistStore(store);
const ProviderWrapper = ({ children }) => {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
{children}
</PersistGate>
</Provider>
)
};
export default ProviderWrapper
non-serializable value error
https://github.com/rt2zz/redux-persist/issues/988
redux-starter-kit과 같이 사용시 발생
해결 방법 :
const store = configureStore({
reducer: rootReducer,
middleware: [...getDefaultMiddleware(), sagaMiddleware ]
});
이 코드를
const store = configureStore({
reducer: rootReducer,
middleware: [ sagaMiddleware ]
});
이렇게 코치기 ...getDefaultMiddleware() 삭제
Comments