【发布时间】:2019-04-01 05:08:45
【问题描述】:
我对 Next.js 还很陌生,到目前为止,我对它的体验非常棒。 但是,我很困惑如何在 Next.js 中执行以下代码 主要是所有这些都是客户端路由并在用户页面中呈现嵌套组件。
${currentPath} 在下面的 sn-p 中是 /user。
<div>
<UserNavbar/>
<SecondaryNavbar/>
<div>
<Route path={`${currentPath}/dashboard`} exact
render={() => <Dashboard {...this.props}/>} />
<Route path={`${currentPath}/listings`} exact
render={() => <Listings {...this.props}/>} />
<Route path={`${currentPath}/listings/new`} exact
render={() => <AddNewListing {...this.props}/>} />
<Route path={`${currentPath}/account`} exact
render={() => <Account {...this.props} /> } />
</div>
</div>
可能是我对这个完全偏离了轨道。我也尝试在 Next.js 频谱聊天中寻求帮助。
感谢任何帮助。谢谢!
【问题讨论】:
标签: javascript reactjs react-router next.js