- React Router Quick Start Guide
- Sagar Ganatra
- 110字
- 2021-07-23 16:41:33
The sensitive prop
A <Route> component's path is not case-sensitive, that is, a <Route> component with its path prop value set to '/Dashboard' would match the '/dashboard' or '/DASHBOARD' URL path. To make a <Route> component's path case-sensitive, add the sensitive prop:
<Route
path="/Dashboard"
component={DashboardComponent}
sensitive
/>
The sensitive prop ensures that the path prop's case is taken into consideration when matching it with the browser's URL path. By adding the sensitive prop, one can define routes with the same pathname, but do so using a different case:
<Route
path="/Dashboard"
component={DashboardComponent}
sensitive
/>
<Route
path="/dashboard"
component={StockListComponent}
sensitive
/>
This code would create two distinct routes and would render the corresponding component when the <Route> component's case-sensitive path matches the browser's URL path.
推薦閱讀
- C# Programming Cookbook
- oreilly精品圖書:軟件開發者路線圖叢書(共8冊)
- 算法訓練營:提高篇(全彩版)
- Java Web程序設計任務教程
- SQL Server從入門到精通(第3版)
- NoSQL數據庫原理
- Learning jQuery(Fourth Edition)
- Vue.js 2 Web Development Projects
- Machine Learning With Go
- UML2面向對象分析與設計(第2版)
- Web Developer's Reference Guide
- Flask Web開發:基于Python的Web應用開發實戰(第2版)
- 實戰Python網絡爬蟲
- 網頁設計與制作
- 零基礎入門Python數據分析與機器學習