import React from 'react'import { Router, Route, IndexRoute, hashHistory } from 'react-router'import Frame from '../layouts/Frame'import Home from '../views/Home'import Detail from '../views/Detail'const routes = ( <Router history={hashHistory}> <Route path="/" component={Frame} /> <IndexRoute component={Home} /> <Route path="/detail:id" component={Detail} /> </Router>)export default routesWarning: [react-router] An <IndexRoute> does not make sense at the root of your route configIndexRoute组件里的Home组件是正常的,单独拿出来也能显示,实在不清楚报错的原因
1 回答
陪伴而非守候
TA贡献1757条经验 获得超8个赞
例子上是这个样子的,你是不是写的结构有问题?
<Router>
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="accounts" component={Accounts}/>
<Route path="statements" component={Statements}/>
</Route>
</Router>
添加回答
举报
0/150
提交
取消