reactjs - 反应布局组件在反应路由器中渲染特定路由
问题描述
我正在使用 Gatsby @reach/router
,我有这个简单的路由器
<>
<Router basepath="/video">
<Auth path="/assessment/:keyId" />
</Router>
<Layout>
<Router basepath="/video">
<PrivateRoute path="/register/:keyId" component={Register} />
<PrivateRoute path="/tutorial/:keyId" component={Tutorial} />
<PrivateRoute path="/test/:keyId" component={Test} />
<PrivateRoute path="/questions/:keyId" component={Questions} />
<PrivateRoute path="/complete/:keyId" component={Complete} />
<PrivateRoute path="/personality/:keyId" component={Personality} />
<PrivateRoute path="/results/:keyId" component={Results} />
</Router>
</Layout>
</>
在Layout
组件上,我有这么简单:
<>
<Header />
{children}
</>
问题出在<Auth/>
组件上。它在上面渲染<Header/>
。为什么?我正在包装一个特定的路线来渲染<Layout/>
,除了<Auth/>
. 我做错了什么?有什么解决办法吗?
解决方案
推荐阅读
- php - 如何计算非空变量以获得非空的总和
- docusignapi - 如何将发件人更改为其他用户?
- azure - Azure 表单识别器 - 标签变量类型数据 - 接收列表中的数据
- javascript - 如何循环遍历对象数组以添加缺少值的对象
- amazon-web-services - 从 S3 存储桶读取火花的 AWS 收费?
- c - 如何在字符串中查找单词而不是子字符串
- google-bigquery - 如何在云数据融合中使用 BigQuery 视图作为源?
- google-data-studio - 如何在 Google Data Studio 中划分两个参数?
- android - 如何在 Android Studio 的 Git 本地更改中禁用 .so 文件差异
- reactjs - 如何在 react-redux 中呈现更新的状态?