September 2018
Beginner
156 pages
3h 28m
English
In the following code snippet, a <Route> with a path param is listed as the second entry:
<Switch> <Route path="/github" component={LoginComponent} /> <Route path="/github/:userId" component={DashboardComponent} /></Switch>
In the previous example, <Route> with path /github would match the URL path /github as well as path /github/mjackson; thus, the first <Route> is rendered even when a <Route> with a specific path is available. To fix this, either provide the exact prop or list the <Route> with path /github below the <Route> with path /github/:userId.
From both cases mentioned in the previous paragraph, listing <Route> components with specific paths above <Route> components with generic paths would avoid undesirable ...
Read now
Unlock full access