0
我無法獲得我的索引路由(家庭組件)加載,真的會感謝一些幫助,因爲我做錯了什麼?異步IndexRoute不與反應路由器加載
我routes.js文件看起來像這樣
module.exports = <Route
path="/"
getComponent={(location, cb) => {
require.ensure([], (require) => {
cb(null, require('./Container'))
})
}}
getChildRoutes={(location, cb) => {
require.ensure([], (require) => {
cb(null, require('./Container').childRoutes)
})
}}
getIndexRoute={(location, cb) => {
require.ensure([], (require) => {
cb(null, require('./Container').indexRoute)
})
}}
/>
和我Container.js文件看起來像這樣
export default class Container extends Component {
render =() => {
return <div>
{this.props.children}
</div>
}
}
Container.childRoutes = [
<Route
path="/:product/get-quote"
component={props => <Product productName={props.params.product} {...props} />}
/>,
<Route
path="/:product/processing-quote"
component={props => <ProcessingQuote productName={props.params.product} {...props} />}
/>
]
Container.indexRoute = <IndexRoute component={Home} />
更改爲Container.indexRoute = {component:Home}'感謝taion – Ally