일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- background: url
- hook
- React 18
- Babel
- React 공식문서
- context
- React 18 Nextjs
- React18
- react hook
- Nextjs React 18
- notFound()
- Nextjs
- CSS
- 고급안내서
- React API 참고서
- background setInterval
- React 고급안내서
- react-helmet
- React 고급 안내서
- background setttimeout
- react
- next13 head
- Next13
- codingtest
- Programmers
- Javascript
- getUTCDate
- RTK Query
- Render Props
- background tab
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