Skip to content

Commit 96e445c

Browse files
committed
Add path syntax example
Yesterday I spent a lot of time to figure out how to do this. In fact, I found like 4-5 search results regarding the same issue. There is no place that actually tells you that you can do something like "/:user?/brands/:brand?/home" using this syntax.
1 parent e9067ff commit 96e445c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

docs/guides/basics/RouteMatching.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ A route path is [a string pattern](/docs/Glossary.md#routepattern) that is used
2020
<Route path="/hello/:name"> // matches /hello/michael and /hello/ryan
2121
<Route path="/hello(/:name)"> // matches /hello, /hello/michael, and /hello/ryan
2222
<Route path="/files/*.*"> // matches /files/hello.jpg and /files/path/to/hello.jpg
23+
<Route path="/:slug?/home"> // matches /[anything]/home like /github/home
2324
```
2425

2526
If a route uses a relative `path`, it builds upon the accumulated `path` of its ancestors. Nested routes may opt-out of this behavior by [using an absolute `path`](RouteConfiguration.md#decoupling-the-ui-from-the-url).

0 commit comments

Comments
 (0)