react-router4 子组件渲染位置控制

新手上路,请多包涵

嵌套路由,如何控制 {NavBase} 在 {RestAPIBase} 中渲染的位置

    const RestAPIBaseChild = ({ match }) => (
        <div>
            <Route path="/" component={RestAPIBase}/>
            <Route path={match.url + '/NavBase'} component={NavBase}/>
        </div>
    );

    return (
        <Router>
            <div>
                <Route path="/app" component={App}/>
                <Route path="/parent" component={Parent}/>
                <Route path="/abc" component={Parentdemo} />
                <Route path="/navbase" component={NavBase} />
                <Route path="/post" component={RestAPIBaseChild} />
            </div>
        </Router>
    )
阅读 2.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进