Skip to content

Commit 2443ea7

Browse files
committed
Merge pull request remix-run#2946 from jamischarles/docs_unreachable_route
docs: Add unreachable routes troubleshooting
2 parents 1139f81 + 80c8785 commit 2443ea7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/Troubleshooting.md

+18
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,21 @@ const App = React.createClass({
1818
}
1919
})
2020
```
21+
22+
### Component won't render
23+
Route matching happens in the order they are defined (think `if/elseif` statement). In this case, `/about/me` will show the `UserPage` component because `/about/me` matches the first route. You need to reorder your routes if this happens.
24+
`About` will never be reachable:
25+
```js
26+
<Router>
27+
<Route path="/:userName/:id" component={UserPage}/>
28+
<Route path="/about/me" component={About}/>
29+
</Router>
30+
```
31+
32+
`About` is now be reachable:
33+
```js
34+
<Router>
35+
<Route path="/about/me" component={About}/>
36+
<Route path="/:userName/:id" component={UserPage}/>
37+
</Router>
38+
```

0 commit comments

Comments
 (0)