-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- rootAction 생성 - rootActionTypes 생성 - rootReducer 생성 - rootSelectort 생성
- Loading branch information
1 parent
d03c785
commit 2aa0446
Showing
5 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { applyMiddleware, compose, createStore } from 'redux'; | ||
import { createBrowserHistory } from 'history'; | ||
import { routerMiddleware } from 'connected-react-router'; | ||
import { createRootReducer } from './rootReducer'; | ||
|
||
const history = createBrowserHistory(); | ||
|
||
const rootReducer = createRootReducer(history); | ||
|
||
declare global { | ||
interface Window { | ||
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose; | ||
} | ||
} | ||
|
||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; | ||
|
||
|
||
export default function configureStore() { | ||
const store = createStore( | ||
rootReducer, | ||
compose( | ||
applyMiddleware(routerMiddleware(history)), | ||
composeEnhancers | ||
) | ||
); | ||
|
||
return { | ||
store, | ||
history, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './users/actionTypes' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { routerActions as router } from 'connected-react-router' | ||
import * as user from './users/actions' | ||
|
||
export { router, user } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { connectRouter } from 'connected-react-router' | ||
import { combineReducers } from 'redux' | ||
import user from './users/reducers' | ||
|
||
const createRootReducer = (history) => | ||
combineReducers({ | ||
router: connectRouter(history), | ||
user, | ||
}) | ||
|
||
export { createRootReducer } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as users from './users/selectors' | ||
|
||
export { users } |