【发布时间】:2019-04-03 09:47:36
【问题描述】:
我有一些添加了 header、div 和 sidemenu 的路由。 在这些之外,我添加了“找不到页面”路线。但是当我点击无效的 URL 时,它没有显示“未找到页面”页面
我尝试将所有路由放在“div”内,但我不需要“找不到页面”页面的这些 div、标题、侧边菜单
<Switch>
<Route path="/" exact component={LoginPage} />
<Route path="/ShowReport" component={ShowReport} />
<div className="container-fluid py-5">
<Header />
<Notify />
<div className="row justify-content-center pt-2">
<Sidemenu />
<Route path="/test" component={Test} />
<Route path="/home" component={HomePage} />
</div>
</div>
<Route component={NotFoundPage} />
</Switch>
预期的结果是:当我点击无效的 URL 时,应该显示找不到没有标题的页面,sidemnu。
【问题讨论】:
标签: javascript reactjs react-router-dom