有定义的Router如下所示:
const routes = (
<Router history={history}>
<Route path="/" component={AppRoot}>
<IndexRoute component={Home} />
<Route path="signup" component={Signup} />
<Route path="login" component={Login} />
<Route path="logout" component={Logout} />
<Route path="*" component={NotFound} />
</Route>
</Router>
);
浏览器访问http://localhost:3000/
时,没有自动加载Home组件,鼠标点击一下页面上的首页,就可以加载,是怎么回事?如何访问http://localhost:3000/
时自动加载IndexRoute的Home组件?
找到问题了!