Skip to content

Commit

Permalink
Add store.js file to handle store configuration (#1666)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbodnar committed May 18, 2021
1 parent cc56f8c commit c394cba
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/redux/store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { createStore } from 'redux'
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import { createBrowserHistory } from 'history'

import createRootReducer from '../reducers'
import createMiddleware from '../middleware'

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

export const history = createBrowserHistory()

const persistedReducer = persistReducer(persistConfig, createRootReducer(history))

export const store = createStore(persistedReducer, createMiddleware(history))

export let persistor = persistStore(store)

0 comments on commit c394cba

Please sign in to comment.