use configureStore of redux-toolkit instead of createStore of redux (#24790)
parent
2839fbc733
commit
8227af8dcc
4 changed files with 23 additions and 7 deletions
@ -1,15 +1,16 @@ |
||||
import { createStore, applyMiddleware, compose } from 'redux'; |
||||
import { configureStore } from '@reduxjs/toolkit'; |
||||
import thunk from 'redux-thunk'; |
||||
import appReducer from '../reducers'; |
||||
import loadingBarMiddleware from '../middleware/loading_bar'; |
||||
import errorsMiddleware from '../middleware/errors'; |
||||
import soundsMiddleware from '../middleware/sounds'; |
||||
|
||||
export default function configureStore() { |
||||
return createStore(appReducer, compose(applyMiddleware( |
||||
export const store = configureStore({ |
||||
reducer: appReducer, |
||||
middleware: [ |
||||
thunk, |
||||
loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }), |
||||
errorsMiddleware(), |
||||
soundsMiddleware(), |
||||
), window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f)); |
||||
} |
||||
], |
||||
}); |
||||
|
Loading…
Reference in new issue