aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/vendor/react-router/docs/guides/path-matching.md
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2014-09-10 14:22:26 +1200
committerAldo Cortesi <aldo@nullcube.com>2014-09-10 14:23:10 +1200
commit0510c9b111aed03d0d3680db63614d50f231745c (patch)
tree0d2fec5d46a3cb984a8b12e36db2f44a1a8eaa5a /web/src/vendor/react-router/docs/guides/path-matching.md
parent76982937a68a2adaf96ec2d258e369d7c871a609 (diff)
downloadmitmproxy-0510c9b111aed03d0d3680db63614d50f231745c.tar.gz
mitmproxy-0510c9b111aed03d0d3680db63614d50f231745c.tar.bz2
mitmproxy-0510c9b111aed03d0d3680db63614d50f231745c.zip
Client-side framework for web application
Diffstat (limited to 'web/src/vendor/react-router/docs/guides/path-matching.md')
-rw-r--r--web/src/vendor/react-router/docs/guides/path-matching.md83
1 files changed, 83 insertions, 0 deletions
diff --git a/web/src/vendor/react-router/docs/guides/path-matching.md b/web/src/vendor/react-router/docs/guides/path-matching.md
new file mode 100644
index 00000000..67eadce9
--- /dev/null
+++ b/web/src/vendor/react-router/docs/guides/path-matching.md
@@ -0,0 +1,83 @@
+Path Matching
+=============
+
+Relative v. Absolute Paths
+--------------------------
+
+Paths that start with `/` are absolute, paths that don't are relative,
+meaning they extend their parent's path.
+
+```xml
+<Route path="/">
+ <!-- /courses/123 -->
+ <Route path="courses/:courseId">
+ <!-- /courses/123/anouncements -->
+ <Route path="announcements" />
+ <!-- /courses/123/dashboard -->
+ <Route path="dashboard" />
+ </Route>
+ <!-- /inbox -->
+ <Route path="inbox">
+ <!-- /messages/123 -->
+ <Route path="/messages/:messageId"/>
+ </Route>
+</Route>
+```
+
+Absolute paths allow you to use any URL you want while maintaining the
+automatic view nesting of the router.
+
+Dynamic Segments
+----------------
+
+Dynamic segements are defined with a `:`, like `:userId`. They will be
+parsed and available by name in your route handler on
+`this.props.params`. They match most characters except `. / ? #`.
+
+Splats
+------
+
+Splats are defined with `*` and will non-greedily match anything. The
+value will be available in your route handler as
+`this.props.params.splat`. If there are multiple, you'll get an array of
+values.
+
+Question Mark
+-------------
+
+Question marks will optionally match the preceeding segment.
+
+Examples
+--------
+
+```
+path: /file/:name.?:ext?
+matches:
+ /file/foo.js
+ this.props.params: {name: 'foo', ext: 'js'}
+ /file/foo
+ this.props.params: {name: 'foo'}
+does not match:
+ /file/foo.bar.js
+ /file/quux/baz.js
+
+path: /file/*
+matches:
+ /file/foo.bar.js
+ this.props.params: {splat: 'foo.bar.js'}
+ /file/quux/baz.js
+ this.props.params: {splat: 'quux/baz.js'}
+
+path: /foo/*/:bar/?*?
+matches:
+ /foo/a.b.c/taco/def
+ this.props.params: {bar: 'taco', splat: ['a.b.c', 'def']}
+ /foo/a.b.c/taco
+ this.props.params: {bar: 'taco', splat: 'a.b.c'}
+does not match:
+ /foo/a.b.c
+
+path: *
+matches everything, but you probably want `<NotFoundRoute/>`
+```
+