-
-
Save anonymous/51f5e16cbcbcdfe8b18141733a08f0d6 to your computer and use it in GitHub Desktop.
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
// routes/Products/routes/ProductEdit/index.js | |
import { injectReducer } from 'store/reducers' | |
export default (store) => ({ | |
path : ':id', | |
getComponent(nextState, cb) { | |
require.ensure([], (require) => { | |
const component = require('./container').default | |
const reducer = require('./reducers').default | |
injectReducer(store, { key: 'product-edit', reducer }) | |
cb(null, component) | |
/* Webpack named bundle */ | |
}, 'product-edit') | |
} | |
}) |
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
// routes/Products/index.js | |
import { injectReducer } from 'store/reducers' | |
import ProductEdit from './routes/ProductEdit' | |
export default (store) => { | |
return { | |
path : 'products', | |
childRoutes: [ | |
ProductEdit(store) | |
], | |
getIndexRoute(nextState, cb) { | |
require.ensure([], (require) => { | |
const component = require('./container').default | |
const reducer = require('./reducers').default | |
injectReducer(store, { key: 'products', reducer }) | |
cb(null, { component }) | |
/* Webpack named bundle */ | |
}, 'products') | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment