- 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.
推薦閱讀
- 基于粒計算模型的圖像處理
- Flutter開發實戰詳解
- Linux環境編程:從應用到內核
- Big Data Analytics
- HTML5入門經典
- Jupyter數據科學實戰
- 零基礎輕松學SQL Server 2016
- HTML5與CSS3基礎教程(第8版)
- Mastering Business Intelligence with MicroStrategy
- Python圖形化編程(微課版)
- Java圖像處理:基于OpenCV與JVM
- Python Machine Learning Blueprints:Intuitive data projects you can relate to
- Machine Learning for Developers
- Node.js從入門到精通
- UI動效設計從入門到精通