Created
June 6, 2017 15:44
-
-
Save javarouka/b31765fe9e86efbc5fb2be905d87077e to your computer and use it in GitHub Desktop.
dynamic-route with react-router 4.x
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
import { injectReducer } from 'store/createRootReducer' | |
const appendReducer = (store, key, reducerModule) => { | |
const reducer = reducerModule.default || reducerModule; | |
injectReducer(store, { key, reducer }); | |
}; | |
// TODO: 계층형 라우팅 추가 필요 | |
export const routes = [ | |
{ | |
exact: true, | |
path: '/', | |
component(store) { | |
appendReducer(store, 'entry', require('container/entry/reducer')); | |
return import('container/entry/EntryContainer'); | |
} | |
}, | |
{ | |
path: '/inquiry/registration', | |
component(store) { | |
appendReducer(store, 'inquiry/registration', require('container/inquiry/reducer')); | |
return import('container/inquiry/InquiryRegistrationContainer'); | |
} | |
}, | |
{ | |
path: '/order/member', | |
component(store) { | |
appendReducer(store, 'inquiry/member', require('container/order/reducer')); | |
return import('container/order/MemberOrderContainer'); | |
} | |
} | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment