- 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.
推薦閱讀
- Web程序設計及應用
- Boost程序庫完全開發指南:深入C++”準”標準庫(第5版)
- Learning RabbitMQ
- JMeter 性能測試實戰(第2版)
- Python語言程序設計
- Java應用開發與實踐
- 從程序員到架構師:大數據量、緩存、高并發、微服務、多團隊協同等核心場景實戰
- 趣學Python算法100例
- C語言程序設計
- Easy Web Development with WaveMaker
- Mastering RStudio:Develop,Communicate,and Collaborate with R
- PostgreSQL Replication(Second Edition)
- INSTANT Passbook App Development for iOS How-to
- Getting Started with Gulp
- Getting Started with React Native