이준호

[ADD] redux-persist 모듈 추가로 새로고침 대응

......@@ -20,6 +20,7 @@
"react-social-kr": "^1.1.9",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"sass-loader": "^10.1.0",
"styled-components": "^5.2.1",
......
......@@ -11,14 +11,19 @@ import {createStore,applyMiddleware} from "redux";
import rootReducer from "./store/index";
import Thunk from 'redux-thunk';
import {composeWithDevTools} from "redux-devtools-extension";
import {persistStore} from "redux-persist";
import {PersistGate} from "redux-persist/integration/react";
const store = createStore(rootReducer,composeWithDevTools(applyMiddleware(Thunk)));
const persistor = persistStore(store);
ReactDOM.render(
<Provider store={store}>
<PersistGate persistor={persistor}>
<React.StrictMode>
<App />
</React.StrictMode>
</PersistGate>
</Provider>,
document.getElementById('root')
);
......
import {combineReducers} from 'redux';
import {persistReducer} from "redux-persist";
import result from "./action/result";
import survey from "./action/survey";
import storage from "redux-persist/lib/storage";
const persistConfig = {
key: "root",
storage: storage,
whitelist: ["result","survey"],
};
const rootReducer = combineReducers({
result,
survey
})
export default rootReducer;
\ No newline at end of file
export default persistReducer(persistConfig,rootReducer);
\ No newline at end of file
......
......@@ -10250,6 +10250,11 @@ redux-devtools-extension@^2.13.8:
resolved "https://registry.yarnpkg.com/redux-devtools-extension/-/redux-devtools-extension-2.13.8.tgz#37b982688626e5e4993ff87220c9bbb7cd2d96e1"
integrity sha512-8qlpooP2QqPtZHQZRhx3x3OP5skEV1py/zUdMY28WNAocbafxdG2tRD1MWE7sp8obGMNYuLWanhhQ7EQvT1FBg==
redux-persist@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/redux-persist/-/redux-persist-6.0.0.tgz#b4d2972f9859597c130d40d4b146fecdab51b3a8"
integrity sha512-71LLMbUq2r02ng2We9S215LtPu3fY0KgaGE0k8WRgl6RkqxtGfl7HUozz1Dftwsb0D/5mZ8dwAaPbtnzfvbEwQ==
redux-thunk@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622"
......