查找: Missing Catch-所有 Route
找错误 简单
题目
什么是 错误使用这个 route 设置?
代码
<Routes>
<Route path="/" element={<Home />} />
<Route path="/about" element={<About />} />
</Routes>
// User navigates to /contact
提示
什么 happens 当否 route matches URL?
解释
那里's 否 catch-所有 route for unmatched URLs. 当用户导航到 /contact, React Router 渲染无 (空白 page). fix 是到 添加: <Route path="*" 元素={<NotFound />} /> as 最后 route.
相关资源
相关课程
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。