Skip to content

Commit

Permalink
redux-persist configuration (#1666)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbodnar committed May 18, 2021
1 parent bb715a1 commit 4581c40
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import ReactDOM from 'react-dom'
import { initSentry } from './utils/sentry'

import { createStore } from 'redux'

import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import { PersistGate } from 'redux-persist/integration/react'

import { Provider } from 'react-redux'
import { LocalizeProvider } from 'react-localize-redux';
import { createBrowserHistory } from 'history'
Expand All @@ -17,9 +22,17 @@ import Routing from './components/Routing'

initSentry();

const persistConfig = {
key: 'root',
storage,
}

const history = createBrowserHistory()

export const store = createStore(createRootReducer(history), createMiddleware(history))
const persistedReducer = persistReducer(persistConfig, createRootReducer(history))

export const store = createStore(persistedReducer, createMiddleware(history))
let persistor = persistStore(store)

ReactDOM.render(
<Provider store={store}>
Expand Down

0 comments on commit 4581c40

Please sign in to comment.