September 2018
Beginner
156 pages
3h 28m
English
When the <Route> path has a trailing slash, and you would like to match this path, including the trailing slash, with the browser's URL, then include the strict prop. For example, after changing the <Route> path from '/dashboard' to '/dashboard/', the <Route> component would still match the URL path without the trailing slash. In other words, '/dashboard' would match the <Route> component with the '/dashboard/' path.
However, after adding the strict prop, React-Router ensures that <Route> matches only if the URL has a trailing slash:
<Route path="/dashboard/" component={DashboardComponent} strict/>
With this <Route> configuration in place, the '/dashboard' path would not match. However, when you add a trailing slash to the ...
Read now
Unlock full access