Skip to content

Commit a4e3d79

Browse files
authored
Example with regex in path
Related to remix-run#391 and this example remix-run#391 (comment)
1 parent 5f881db commit a4e3d79

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

website/modules/examples/Params.js

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const ParamsExample = () => (
1717
</ul>
1818

1919
<Route path="/:id" component={Child}/>
20+
<Route path="/order/:direction(asc|desc)" component={ComponentWithRegex}/>
2021
</div>
2122
</Router>
2223
)
@@ -27,4 +28,10 @@ const Child = ({ match }) => (
2728
</div>
2829
)
2930

31+
const ComponentWithRegex = ({ match }) => (
32+
<div>
33+
<h3>Only asc/desc are allowed: {match.params.direction}</h3>
34+
</div>
35+
)
36+
3037
export default ParamsExample

0 commit comments

Comments
 (0)