嗨我得到一个错误:
[react-router] Location "/setup/gender" did not match any routes
我能够访问/设置,一切正常。 这是react-router代码:
ReactDOM.render(
<Router history={browserHistory}>
<Route path="/" component={Root}>
<IndexRoute component={Home} />
<Route path ="/setup">
<IndexRoute component={Setup} />
<Route path="/gender" component={Gender}></Route>
</Route>
</Route>
</Router>,
document.getElementById('root')
);
并在我的设置组件中:
export default class Setup extends Component {
render() {
return (
<div>
<Link to="/setup/gender">gender</Link>
<SetupNav />
{this.props.children}
</div>
)
}
}
我有什么遗失的吗?
答案 0 :(得分:0)
<Route path="/gender" component={Gender}></Route>
应该成为
<Route path="/setup/gender" component={Gender}></Route>